Structs§
- “Elaboration” is the process of identifying all the predicates that are implied by a source predicate. Currently, this basically means walking the “supertraits” and other similar assumptions. For example, if we know that
T: Ord
, the elaborator would deduce thatT: PartialOrd
holds as well. Similarly, if we havetrait Foo: 'static
, and we know thatT: Foo
, then we know thatT: 'static
. - A filter around an iterator of predicates that makes it yield up just trait references.
- The inverse of
BoundVarReplacer
: replaces placeholders with the bound vars from which they came. - “Trait alias expansion” is the process of expanding a sequence of trait references into another sequence by transitively following all trait aliases. e.g. If you have bounds like
Foo + Send
, a trait aliastrait Foo = Bar + Sync;
, and another trait aliastrait Bar = Read + Write
, then the bounds would expand toRead + Write + Sync + Send
. Expansion is done via a DFS (depth-first search), and thevisited
field is used to avoid cycles. - Stores information about the expansion of a trait via a path of zero or more trait aliases.
Enums§
Traits§
- Describes how to elaborate an obligation into a sub-obligation.
Functions§
- Computes the def-ids of the transitive supertraits of
trait_def_id
. This (intentionally) does not compute the full elaborated super-predicates but just the set of def-ids. It is used to identify which traits may define a given associated type to help avoid cycle errors, and to make size estimates for vtable layout computation. - A specialized variant of
elaborate
that only elaborates trait references that may define the given associated item with the nameassoc_name
. It uses theexplicit_supertraits_containing_assoc_item
query to avoid enumerating super-predicates that aren’t related toassoc_item
. This is used when resolving types likeSelf::Item
orT::Item
and helps to avoid cycle errors (see e.g. #35237). - Casts a trait reference into a reference to one of its super traits; returns
None
iftarget_trait_def_id
is not a supertrait. - Executes
f
onvalue
after replacing all escaping bound variables with placeholders and then replaces these placeholders with the original bound variables in the result.