Copies of the relevant MIR types. MIR represents a rust (function) body as a CFG. It’s a
semantically rich representation that contains no high-level control-flow operations like loops
or patterns; instead the control flow is entirely described by gotos and switches on integer
values.
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.
Represents the “shape” of a function pointer, i.e. the most general signature we can obtain
from it without breaking the higher-kinded variables. E.g. for<'a> fn(&'a u32) -> Adt<'a, u32> is considered to be an instantiation of the shape for<'a> fn(&'a A) -> Adt<'a, B> with
A=B=u32.
This is a pretty criminal hack: I want to generate ty::Generics for my fake items. This
requires DefIds for the generic parameters. rustc has an affordance for creating new DefIds
(tcx.create_def()) but I could not figure out a way to use it that didn’t end up ICEing
during metadata encoding. So instead I’m reusing the DefIds of generic parameters from core
functions.
A binder that wraps something that may mention the late-bound variables of an item. This does
not count for de Bruijn indices: the late bound vars will instead be referred to using
LateParam, using the def_id of this binder. That def_id is always that of the item,
except in cases where the item doesn’t have a rustc DefId, in which case we use a dummy one.
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.
A De Bruijn index is a standard means of representing
regions (and perhaps later types) in a higher-ranked setting. In
particular, imagine a type like this:
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, as we can then solve traits
for them etc, and works well with monomorphization.
Okay, we do something fun for Bound types/regions/consts:
Specifically, we distinguish between canonically bound things and
for<> bound things. And, really, it comes down to caching during
canonicalization and instantiation.
Reflects [ty::TraitRef]
Contains the def_id and arguments passed to the trait. The first type argument is the Self
type. The trait proofs 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.