Module rustc_middle::ty [−][src]
Defines how the compiler represents types internally.
Two important entities in this module are:
rustc_middle::ty::Ty
, used to represent the semantics of a type.rustc_middle::ty::TyCtxt
, the central data structure in the compiler.
For more information, see “The ty
module: representing types” in the ructc-dev-guide.
Re-exports
pub use self::fold::TypeFoldable; |
pub use self::fold::TypeFolder; |
pub use self::fold::TypeVisitor; |
pub use self::AssocItemContainer::*; |
pub use self::BorrowKind::*; |
pub use self::IntVarValue::*; |
pub use self::Variance::*; |
pub use self::sty::BoundRegionKind::*; |
pub use self::sty::RegionKind::*; |
pub use self::sty::TyKind::*; |
pub use rustc_type_ir::InferTy::*; |
pub use self::binding::BindingMode; |
pub use self::binding::BindingMode::*; |
pub use self::trait_def::TraitDef; |
Modules
_match | |
adjustment | |
binding | |
cast | |
codec | |
consts | |
context | Type context book-keeping. |
diagnostics | Diagnostics related methods for |
erase_regions | |
error | |
fast_reject | |
flags | |
fold | Generalized type folding mechanism. The setup is a bit convoluted
but allows for convenient usage. Let T be an instance of some
“foldable type” (one which implements |
inhabitedness | |
instance | |
layout | |
list | |
normalize_erasing_regions | Methods for normalizing when you don’t care about regions (and
aren’t doing type inference). If either of those things don’t
apply to you, use |
outlives | |
query | |
relate | Generalized type relating mechanism. |
structural_impls | This module contains implements of the |
sty | This module contains |
subst | |
tls | |
trait_def | |
util | Miscellaneous type-system utilities that are too small to deserve their own modules. |
walk | An iterator over the type substructure. WARNING: this does not keep track of the region depth. |
Structs
AdtDef | The definition of a user-defined type, e.g., a |
AdtFlags | |
AdtSizedConstraint | |
AssocItem | |
AssociatedItems | A list of |
Binder | Binder is a binder for higher-ranked lifetimes or types. It is part of the
compiler’s representation for things like |
BoundConst | |
BoundRegion | |
BoundTy | |
BoundVar | |
CReaderCacheKey | |
CanonicalUserTypeAnnotation | |
CaptureInfo | Part of |
CapturedPlace | A composite describing a |
ClosureSubsts | A closure can be modeled as a struct that looks like: |
ClosureSubstsParts | Struct returned by |
Const | Typed constant value. |
ConstInt | A type for representing any integer. Only used for printing. |
ConstVid | A |
ConstnessAnd | |
CrateInherentImpls | A map for the local crate mapping each type to a vector of its
inherent impls. This is not meant to be used outside of coherence;
rather, you should request the vector for a specific type via
|
CratePredicatesMap | The crate outlives map is computed during typeck and contains the
outlives of every item in the local crate. You should not use it
directly, because to do so will make your pass dependent on the
HIR of every item in the local crate. Instead, use
|
CrateVariancesMap | The crate variances map is computed during typeck and contains the
variance of every item in the local crate. You should not use it
directly, because to do so will make your pass dependent on the
HIR of every item in the local crate. Instead, use
|
CtxtInterners | |
DebruijnIndex | 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: |
DelaySpanBugEmitted | A type that is not publicly constructable. This prevents people from making |
Destructor | |
EarlyBoundRegion | |
ExistentialProjection | A |
ExistentialTraitRef | An existential reference to a trait, where |
FieldDef | |
FloatVarValue | |
FloatVid | An floating-point ( |
FnSig | Signature of a function type, which we have arbitrarily decided to use to refer to the input/output types. |
FreeRegion | A “free” region |
FreeRegionInfo | |
GenSig | |
GeneratorInteriorTypeCause | Whenever a value may be live across a generator yield, the type of that value winds up in the
|
GeneratorSubsts | Similar to |
GeneratorSubstsParts | |
GenericParamCount | |
GenericParamDef | |
GenericPredicates | Bounds on generics. |
Generics | Information about the formal type/lifetime parameters associated
with an item or method. Analogous to |
GlobalCtxt | |
ImplHeader | The “header” of an impl is everything outside the body: a Self type, a trait ref (in the case of a trait impl), and a set of predicates (from the bounds / where-clauses). |
Instance | A monomorphized |
InstantiatedPredicates | Represents the bounds declared on a particular set of type
parameters. Should eventually be generalized into a flag list of
where-clauses. You can obtain a |
IntVid | An integral ( |
List | A wrapper for slices with the additional invariant that the slice is interned and no other slice with the same contents can exist in the same context. This means we can use pointer for both equality comparisons and hashing. |
OutlivesPredicate | |
ParamConst | |
ParamEnv | When type checking, we use the |
ParamEnvAnd | |
ParamTy | |
Placeholder | The “placeholder index” fully defines a placeholder region, type, or const. Placeholders are identified by both a universe, as well as a name residing within that universe. Distinct bound regions/types/consts within the same universe simply have an unknown relationship to one another. |
Predicate | |
PredicateInner | |
ProjectionPredicate | This kind of predicate has no direct correspondent in the syntax, but it roughly corresponds to the syntactic forms: |
ProjectionTy | Represents the projection of an associated type. In explicit UFCS
form this would be written |
RegionVid | A region (lifetime) variable ID. |
ReprFlags | |
ReprOptions | Represents the repr options provided by the user, |
ResolvedOpaqueTy | All information necessary to validate and reveal an |
ResolverOutputs | |
ScalarInt | The raw bytes of a simple value. |
SubtypePredicate | |
SymbolName | |
TraitObjectVisitor | Collect al types that have an implicit |
TraitPredicate | |
TraitRef | A complete reference to a trait. These take numerous guises in syntax, but perhaps the most recognizable form is in a where-clause: |
TyCtxt | The central data structure of the compiler. It stores references to the various arenas and also houses the results of the various compiler queries that have been performed. See the rustc dev guide for more details. |
TyS | |
TyVid | A type variable ID. |
TypeAndMut | |
TypeFlags | Flags that we track on types. These flags are propagated upwards through the type during type construction, so that we can quickly check whether the type has various kinds of types in it without recursing over the type itself. |
TypeckResults | |
UniverseIndex | “Universes” are used during type- and trait-checking in the
presence of |
UpvarBorrow | |
UpvarId | Upvars do not get their own |
UpvarPath | |
UserTypeAnnotationIndex | |
VariantDef | Definition of a variant – a struct’s fields or a enum variant. |
VariantFlags | |
WithOptConstParam | A |
Enums
AdtKind | |
AssocItemContainer | |
AssocKind | |
BorrowKind | |
BoundRegionKind | |
BoundTyKind | |
ClosureKind | Represents the various closure traits in the language. This
will determine the type of the environment ( |
ConstKind | Represents a constant in Rust. |
ExistentialPredicate | |
FloatTy | |
GenericParamDefKind | |
ImplOverlapKind | |
ImplPolarity | |
InferConst | An inference variable for a const, for use in const generics. |
InferTy | A placeholder for a type that hasn’t been inferred yet. |
InstanceDef | |
IntTy | |
IntVarValue | |
PredicateKind | |
RegionKind | Representation of regions. Note that the NLL checker uses a distinct
representation of regions. For this reason, it internally replaces all the
regions with inference variables – the index of the variable is then used
to index into internal NLL data structures. See |
TyKind | Defines the kinds of types. |
UintTy | |
UpvarCapture | Information describing the capture of an upvar. This is computed
during |
UpvarSubsts | |
UserType | A user-given type annotation attached to a constant. These arise
from constants that are named via paths, like |
Variance | |
VariantDiscr | |
Visibility |
Constants
INNERMOST |
Traits
DefIdTree | |
Lift | A trait implemented for all |
ToPolyTraitRef | |
ToPredicate | |
WithConstness |
Functions
ast_int_ty | |
ast_uint_ty | |
float_ty | |
int_ty | |
is_impl_trait_defn | Yields the parent function’s |
place_to_string_for_capture | |
provide | |
suggest_arbitrary_trait_bound | |
suggest_constraining_type_param | Suggest restricting a type param with a new bound. |
uint_ty |
Type Definitions
Attributes | |
CanonicalPolyFnSig | |
CanonicalUserType | Canonicalized user type annotation. |
CanonicalUserTypeAnnotations | Mapping of type annotation indices to canonical user type annotations. |
MinCaptureInformationMap | Given the closure DefId this map provides a map of root variables to minimum
set of |
MinCaptureList | Part of |
PlaceholderConst | |
PlaceholderRegion | |
PlaceholderType | |
PolyExistentialProjection | |
PolyExistentialTraitRef | |
PolyFnSig | |
PolyGenSig | |
PolyProjectionPredicate | |
PolyRegionOutlivesPredicate | |
PolySubtypePredicate | |
PolyTraitPredicate | |
PolyTraitRef | |
PolyTypeOutlivesPredicate | |
Region | |
RegionOutlivesPredicate | |
RootVariableMinCaptureList | Part of |
Ty | |
TypeOutlivesPredicate | |
UpvarCaptureMap | |
UpvarListMap |