Expand description

Code for projecting associated types out of trait references.

Structs

Enums

States returned from poly_project_and_unify_type. Takes the place of the old return type, which was:
Projected 🔒
When attempting to resolve <T as TraitRef>::Name
Depending on the stage of compilation, we want projection to be more or less conservative.

Traits

Functions

If the predicate’s item is an ImplTraitPlaceholder, we do a select on the corresponding trait ref. If this yields an impl, then we’re able to project to a concrete type, since we have an impl’s method to provide the RPITIT.
In the case of a trait object like <dyn Iterator<Item = ()> as Iterator>::Item we can use the existential predicate in the trait object.
The first thing we have to do is scan through the parameter environment to see whether there are any projection predicates there that can answer this question.
assoc_def 🔒
Locate the definition of an associated type in the specialization hierarchy, starting from the given impl.
Normalizes any associated type projections in value, replacing them with a fully resolved type where possible. The return value combines the normalized result and any additional obligations that were incurred as result.
The guts of normalize: normalize a specific projection like <T as Trait>::Item. The result is always a type (and possibly additional obligations). If ambiguity arises, which implies that there are unresolved type variables in the projection, we will substitute a fresh type variable $X and generate a new obligation <T as Trait>::Item == $X for later.
If we are projecting <T as Trait>::Item, but T: Trait does not hold. In various error cases, we cannot generate a valid normalized projection. Therefore, we create an inference variable return an associated obligation that, when fulfilled, will lead to an error.
As normalize, but with a custom depth.
The guts of normalize: normalize a specific projection like <T as Trait>::Item. The result is always a type (and possibly additional obligations). Returns None in the case of ambiguity, which indicates that there are unbound type variables.
Evaluates constraints of the form:
project 🔒
Computes the result of a projection type (if we can).
Evaluates constraints of the form:
Executes f on value after replacing all escaping bound variables with placeholders and then replaces these placeholders with the original bound variables in the result.

Type Definitions