A representation of exists<T: Trait1 + Trait2>(value): we create a fresh type id and the
appropriate trait clauses. The contained value may refer to the fresh ty and the in-scope trait
clauses. This is used to represent types related to dyn Trait.
Reflects [ty::OutlivesPredicate] as a named struct
instead of a tuple struct. This is because the script converting
JSONSchema types to OCaml doesn’t support tuple structs, and this
is the only tuple struct in the whole AST.
The source of a particular trait implementation. Most often this is either Concrete for a
concrete impl Trait for Type {} item, or LocalBound for a context-bound where T: Trait.
We create some extra DefIds to represent things that rustc doesn’t have a DefId for. This
makes the pipeline much easier to have “real” def_ids for them.
We generate fake struct-like items for each of: arrays, slices, and tuples. This makes it
easier to emit trait impls for these types, especially with monomorphization. This enum tracks
identifies these builtin types.
Erase free regions from the given value. Largely copied from tcx.erase_and_anonymize_regions, but also
erases bound regions that are bound outside value, so we can call this function inside a
Binder.
The signature of a method impl may be a subtype of the one expected from the trait decl, as in
the example below. For correctness, we must be able to map from the method generics declared in
the trait to the actual method generics. Because this would require type inference, we instead
simply return the declared signature. This will cause issues if it is possible to use such a
more-specific implementation with its more-specific type, but we have a few other issues with
lifetime-generic function pointers anyway so this is unlikely to cause problems.
Solve the trait obligations for a specific item use (for example, a method call, an ADT, etc.)
in the current context. Just like generic args include generics of parent items, this includes
impl exprs for parent items.
Given a clause clause in the context of some impl block impl_did, susbts correctly Self
from clause and (1) derive a Clause and (2) resolve an ImplExpr.
Rustc has different representation for constants: one for MIR
([rustc_middle::mir::Const]), one for the type system
([rustc_middle::ty::ConstKind]). For simplicity hax maps those
two construct to one same ConstantExpr type.
An ImplExpr describes the full data of a trait implementation. Because of generics, this may
need to combine several concrete trait implementation items. For example, ((1u8, 2u8), "hello").clone() combines the generic implementation of Clone for (A, B) with the
concrete implementations for u8 and &str, represented as a tree.
Reflects [ty::TraitRef]
Contains the def_id and arguments passed to the trait. The first type argument is the Self
type. The ImplExprs are the required predicate for this trait; currently they are always
empty because we consider all trait predicates as implied.
self.in_trait is always None because a trait can’t be associated to another one.