Module rustc_middle::ty::sty
source · Expand description
This module contains TyKind and its major components.
Structs
- Represents the projection of an associated type.
- Binder is a binder for higher-ranked lifetimes or types. It is part of the compiler’s representation for things like
for<'a> Fn(&'a isize)(which would be represented by the typePolyTraitRef == Binder<'tcx, TraitRef>). Note that when we instantiate, erase, or otherwise “discharge” these bound vars, we change the type fromBinder<'tcx, T>to justT(see e.g.,liberate_late_bound_regions). - A closure can be modeled as a struct that looks like:
- Struct returned by
split(). - A
constvariable ID. - An effect variable ID.
- A
ProjectionPredicatefor anExistentialTraitRef. - An existential reference to a trait, where
Selfis erased. For example, the trait objectTrait<'a, 'b, X, Y>is: - Signature of a function type, which we have arbitrarily decided to use to refer to the input/output types.
- A “free” region
frcan be interpreted as “some region at least as big as the scopefr.scope”. - Similar to
ClosureArgs; see the above documentation for more. - An inline const is modeled like
- Struct returned by
split(). - Use this rather than
RegionKind, whenever possible. - A region (lifetime) variable ID.
- A complete reference to a trait. These take numerous guises in syntax, but perhaps the most recognizable form is in a where-clause:
Enums
- Extra information about why we ended up with a particular variance. This is only used to add more information to error messages, and has no effect on soundness. While choosing the ‘wrong’
VarianceDiagInfomay lead to confusing notes in error messages, it will never cause a miscompilation or unsoundness.