[−][src]Module rustc_infer::infer::nll_relate

This code is kind of an alternate way of doing subtyping, supertyping, and type equating, distinct from the combine.rs code but very similar in its effect and design. Eventually the two ought to be merged. This code is intended for use in NLL and chalk.

Here are the key differences:

Also, this code assumes that there are no bound types at all, not even free ones. This is ok because:

Structs

BoundRegionScope
ScopeInstantiator

When we encounter a binder like for<..> fn(..), we actually have to walk the fn value to find all the values bound by the for (these are not explicitly present in the ty representation right now). This visitor handles that: it descends the type, tracking binder depth, and finds late-bound regions targeting the for<..>. For each of those, it creates an entry in bound_region_scope.

TypeGeneralizer

The "type generalize" is used when handling inference variables.

TypeRelating
UniversallyQuantified

Enums

NormalizationStrategy

Traits

TypeRelatingDelegate
VidValuePair

When we instantiate a inference variable with a value in relate_ty_var, we always have the pair of a TyVid and a Ty, but the ordering may vary (depending on whether the inference variable was found on the a or b sides). Therefore, this trait allows us to factor out common code, while preserving the order when needed.