Module rustc::infer[][src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

See the Book for more information.

Re-exports

pub use self::LateBoundRegionConversionTime::*;
pub use self::RegionVariableOrigin::*;
pub use self::SubregionOrigin::*;
pub use self::ValuePairs::*;
pub use ty::IntVarValue;
use hir::def_id::DefId;
use middle::free_region::RegionRelations;
use middle::region;
use middle::lang_items;
use ty::subst::Kind;
use ty::subst::Substs;
use ty::TyVid;
use ty::IntVid;
use ty::FloatVid;
use ty;
use ty::Ty;
use ty::TyCtxt;
use ty::GenericParamDefKind;
use ty::error::ExpectedFound;
use ty::error::TypeError;
use ty::error::UnconstrainedNumeric;
use ty::fold::TypeFoldable;
use ty::relate::RelateResult;
use traits;
use traits::ObligationCause;
use traits::PredicateObligations;
use rustc_data_structures::unify as ut;
use std::cell::Cell;
use std::cell::RefCell;
use std::cell::Ref;
use std::cell::RefMut;
use std::collections::BTreeMap;
use std::fmt;
use syntax::ast;
use errors::DiagnosticBuilder;
use syntax_pos;
use syntax_pos::Span;
use syntax_pos::symbol::InternedString;
use util::nodemap::FxHashMap;
use util::nodemap::FxHashMap;
use arena::SyncDroplessArena;
use self::combine::CombineFields;
use self::higher_ranked::HrMatchResult;
use self::region_constraints::RegionConstraintCollector;
use self::region_constraints::RegionSnapshot;
use self::region_constraints::GenericKind;
use self::region_constraints::VerifyBound;
use self::region_constraints::RegionConstraintData;
use self::region_constraints::VarInfos;
use self::lexical_region_resolve::LexicalRegionResolutions;
use self::outlives::env::OutlivesEnvironment;
use self::type_variable::TypeVariableOrigin;
use self::unify_key::ToType;

Modules

anon_types [
Experimental
]
at [
Experimental
]

A nice interface for working with the infcx. The basic idea is to do infcx.at(cause, param_env), which sets the "cause" of the operation as well as the surrounding parameter environment. Then you can do something like .sub(a, b) or .eq(a, b) to create a subtype or equality relationship respectively. The first argument is always the "expected" output from the POV of diagnostics.

canonical [
Experimental
]

Canonicalization is the key to constructing a query in the middle of type inference. Ordinarily, it is not possible to store types from type inference in query keys, because they contain references to inference variables whose lifetimes are too short and so forth. Canonicalizing a value T1 using canonicalize_query produces two things:

combine [
Experimental
]
equate [
Experimental
]
error_reporting [
Experimental
]

Error Reporting Code for the inference engine

freshen [
Experimental
]

Freshening is the process of replacing unknown variables with fresh types. The idea is that the type, after freshening, contains no inference variables but instead contains either a value for each variable or fresh "arbitrary" types wherever a variable would have been.

fudge [
Experimental
]
glb [
Experimental
]
higher_ranked [
Experimental
]

Helper routines for higher-ranked things. See the doc module at the end of the file for details.

lattice [
Experimental
]

Lattice Variables

lexical_region_resolve [
Experimental
]

The code to do lexical region resolution.

lub [
Experimental
]
outlives [
Experimental
]

Various code related to computing outlives relations.

region_constraints [
Experimental
]

See README.md

resolve [
Experimental
]
sub [
Experimental
]
type_variable [
Experimental
]
unify_key [
Experimental
]

Structs

CombinedSnapshot [
Experimental
]
InferCtxt [
Experimental
]
InferCtxtBuilder [
Experimental
]

Helper type of a temporary returned by tcx.infer_ctxt(). Necessary because we can't write the following bound: F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>).

InferOk [
Experimental
]
RegionObligation [
Experimental
]

See the region_obligations field for more information.

TypeFreshener [
Experimental
]
TypeTrace [
Experimental
]

The trace designates the path through inference that we took to encounter an error or subtyping constraint.

Enums

FixupError [
Experimental
]
LateBoundRegionConversionTime [
Experimental
]

Times when we replace late-bound regions with variables:

NLLRegionVariableOrigin [
Experimental
]
ParameterOrigin [
Experimental
]

Places that type/region parameters can appear.

RegionVariableOrigin [
Experimental
]

Reasons to create a region inference variable

SubregionOrigin [
Experimental
]

The origin of a r1 <= r2 constraint.

ValuePairs [
Experimental
]

See error_reporting module for more details

Type Definitions

Bound [
Experimental
]
FixupResult [
Experimental
]
InferResult [
Experimental
]
SkolemizationMap [
Experimental
]

A map returned by skolemize_late_bound_regions() indicating the skolemized region that each late-bound region was replaced with.

UnitResult [
Experimental
]