Expand description
Code for projecting associated types out of trait references.
StructsΒ§
- InProgress π
- Progress π
EnumsΒ§
- Project
AndUnify πResult - States returned from
poly_project_and_unify_type. Takes the place of the old return type, which was: - Projected π
- Projection
Candidate π - Projection
Candidate πSet - Projection
Error - When attempting to resolve
<T as TraitRef>::Nameβ¦
TraitsΒ§
FunctionsΒ§
- assemble_
candidates_ πfrom_ impls - assemble_
candidates_ πfrom_ object_ ty - In the case of a trait object like
<dyn Iterator<Item = ()> as Iterator>::Itemwe can use the existential predicate in the trait object. - assemble_
candidates_ πfrom_ param_ env - 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.
- assemble_
candidates_ πfrom_ predicates - assemble_
candidates_ πfrom_ trait_ def - In the case of a nested projection like
<<A as Foo>::FooT as Bar>::BarT, we may find that the definition ofFoohas some clues: - assoc_
term_ πown_ obligations - compute_
inherent_ assoc_ term_ args - confirm_
async_ πclosure_ candidate - confirm_
async_ πfn_ kind_ helper_ candidate - confirm_
async_ πiterator_ candidate - confirm_
builtin_ πcandidate - confirm_
callable_ πcandidate - confirm_
candidate π - confirm_
closure_ πcandidate - confirm_
coroutine_ πcandidate - confirm_
fn_ πpointer_ candidate - confirm_
future_ πcandidate - confirm_
impl_ πcandidate - confirm_
iterator_ πcandidate - confirm_
param_ πenv_ candidate - confirm_
select_ πcandidate - normalize_
inherent_ projection - Confirm and normalize the given inherent projection.
- normalize_
projection_ term - 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$Xand generate a new obligation<T as Trait>::Item == $Xfor later. - normalize_
to_ πerror - If we are projecting
<T as Trait>::Item, butT: Traitdoes 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. - opt_
normalize_ πprojection_ term - The guts of
normalize: normalize a specific projection like<T as Trait>::Item. The result is always a type (and possibly additional obligations). ReturnsNonein the case of ambiguity, which indicates that there are unbound type variables. - poly_
project_ πand_ unify_ term - Evaluates constraints of the form:
- project π
- Computes the result of a projection type (if we can).
- project_
and_ πunify_ term - Evaluates constraints of the form:
- push_
const_ πarg_ has_ type_ obligation - When normalizing a const alias, register a
ConstArgHasTypeobligation to ensure the const valueβs type matches the declared type.