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>::Item
we 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 ofFoo
has some clues: - assoc_
ty_ ๐own_ obligations - compute_
inherent_ assoc_ ty_ 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_ ty - 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. - 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). ReturnsNone
in 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: