Expand description
Code for projecting associated types out of trait references.
Structsยง
- InProgress ๐
- Progress ๐
Enumsยง
- States returned from
poly_project_and_unify_type
. Takes the place of the old return type, which was: - Projected ๐
- Projection
Candidate ๐ - When attempting to resolve
<T as TraitRef>::Name
โฆ
Traitsยง
Functionsยง
- 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.
- In the case of a nested projection like
<<A as Foo>::FooT as Bar>::BarT
, we may find that the definition ofFoo
has some clues: - confirm_
candidate ๐ - Confirm and normalize the given inherent projection.
- 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 instantiate it with a fresh type variable$X
and generate a new obligation<T as Trait>::Item == $X
for later. - normalize_
to_ ๐error If we are projecting<T as Trait>::Item
, butT: 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. - The guts of
normalize
: normalize a specific projection like<T as Trait>::Item
. The result is always a type (and possibly additional obligations). ReturnsNone
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: