Module rustc::ty [] [src]

🔬 This is a nightly-only experimental API. (rustc_private)

Reexports

pub use self::Variance::*;
pub use self::AssociatedItemContainer::*;
pub use self::BorrowKind::*;
pub use self::IntVarValue::*;
pub use self::LvaluePreference::*;
pub use self::fold::TypeFoldable;
pub use self::trait_def::TraitDef;
pub use self::trait_def::TraitFlags;
pub use self::maps::queries;

Modules

_match [
Experimental
]
adjustment [
Experimental
]
cast [
Experimental
]
error [
Experimental
]
fast_reject [
Experimental
]
fold [
Experimental
]

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 TypeFoldable) and F be an instance of a "folder" (a type which implements TypeFolder). Then the setup is intended to be:

inhabitedness [
Experimental
]
item_path [
Experimental
]
layout [
Experimental
]
maps [
Experimental
]
outlives [
Experimental
]
relate [
Experimental
]

Generalized type relating mechanism. A type relation R relates a pair of values (A, B). A and B are usually types or regions but can be other things. Examples of type relations are subtyping, type equality, etc.

subst [
Experimental
]
tls [
Experimental
]
trait_def [
Experimental
]
util [
Experimental
]

misc. type-system utilities too small to deserve their own file

walk [
Experimental
]

An iterator over the type substructure. WARNING: this does not keep track of the region depth.

wf [
Experimental
]

Structs

AdtDef [
Experimental
]

The definition of an abstract data type - a struct or enum.

AdtFlags [
Experimental
]
AssociatedItem [
Experimental
]
Binder [
Experimental
]

Binder is a binder for higher-ranked lifetimes. It is part of the compiler's representation for things like for<'a> Fn(&'a isize) (which would be represented by the type PolyTraitRef == Binder<TraitRef>). Note that when we skolemize, instantiate, erase, or otherwise "discharge" these bound regions, we change the type from Binder<T> to just T (see e.g. liberate_late_bound_regions).

CReaderCacheKey [
Experimental
]
ClosureSubsts [
Experimental
]

A closure can be modeled as a struct that looks like:

ClosureUpvar [
Experimental
]
CrateAnalysis [
Experimental
]

The complete set of all analyses described in this module. This is produced by the driver and fed to trans and later passes.

CrateInherentImpls [
Experimental
]

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 ty::queries::inherent_impls::get(def_id) so as to minimize your dependencies (constructing this map requires touching the entire crate).

DebruijnIndex [
Experimental
]

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:

Destructor [
Experimental
]
EarlyBoundRegion [
Experimental
]
EquatePredicate [
Experimental
]
ExistentialProjection [
Experimental
]

A ProjectionPredicate for an ExistentialTraitRef.

ExistentialTraitRef [
Experimental
]

An existential reference to a trait, where Self is erased. For example, the trait object Trait<'a, 'b, X, Y> is:

FieldDef [
Experimental
]
FloatVid [
Experimental
]
FnSig [
Experimental
]

Signature of a function type, which I have arbitrarily decided to use to refer to the input/output types.

FreeRegion [
Experimental
]

A "free" region fr can be interpreted as "some region at least as big as the scope fr.scope".

GenericPredicates [
Experimental
]

Bounds on generics.

Generics [
Experimental
]

Information about the formal type/lifetime parameters associated with an item or method. Analogous to hir::Generics.

GlobalArenas [
Experimental
]

Internal storage

ImplHeader [
Experimental
]

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 [
Experimental
]
InstantiatedPredicates [
Experimental
]

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 InstantiatedPredicates list from a GenericPredicates by using the instantiate method. Note that this method reflects an important semantic invariant of InstantiatedPredicates: while the GenericPredicates are expressed in terms of the bound type parameters of the impl/trait/whatever, an InstantiatedPredicates instance represented a set of bounds for some particular instantiation, meaning that the generic parameters have been substituted with their values.

IntVid [
Experimental
]
Issue32330 [
Experimental
]

When a region changed from late-bound to early-bound when #32330 was fixed, its RegionParameterDef will have one of these structures that we can use to give nicer errors.

ItemSubsts [
Experimental
]

Records the substitutions used to translate the polytype for an item into the monotype of an item reference.

MethodCall [
Experimental
]

With method calls, we store some extra information in side tables (i.e method_map). We use MethodCall as a key to index into these tables instead of just directly using the expression's NodeId. The reason for this being that we may apply adjustments (coercions) with the resulting expression also needing to use the side tables. The problem with this is that we don't assign a separate NodeId to this new expression and so it would clash with the base expression if both needed to add to the side tables. Thus to disambiguate we also keep track of whether there's an adjustment in our key.

MethodCallee [
Experimental
]
OutlivesPredicate [
Experimental
]
ParamTy [
Experimental
]
ParameterEnvironment [
Experimental
]

When type checking, we use the ParameterEnvironment to track details about the type/lifetime parameters that are in scope. It primarily stores the bounds information.

ProjectionPredicate [
Experimental
]

This kind of predicate has no direct correspondent in the syntax, but it roughly corresponds to the syntactic forms:

ProjectionTy [
Experimental
]

Represents the projection of an associated type. In explicit UFCS form this would be written <T as Trait<..>>::N.

RegionParameterDef [
Experimental
]
RegionVid [
Experimental
]
ReprOptions [
Experimental
]

Represents the repr options provided by the user,

Resolutions [
Experimental
]
SkolemizedRegionVid [
Experimental
]
Slice [
Experimental
]

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 + length for both equality comparisons and hashing.

TraitPredicate [
Experimental
]
TraitRef [
Experimental
]

A complete reference to a trait. These take numerous guises in syntax, but perhaps the most recognizable form is in a where clause:

TyCtxt [
Experimental
]

The data structure to keep track of all the information that typechecker generates so that so that it can be reused and doesn't have to be redone later on.

TyS [
Experimental
]
TyVid [
Experimental
]
TypeAndMut [
Experimental
]
TypeContents [
Experimental
]

Type contents is how the type checker reasons about kinds. They track what kinds of things are found within a type. You can think of them as kind of an "anti-kind". They track the kinds of values and thinks that are contained in types. Having a larger contents for a type tends to rule that type out from various kinds. For example, a type that contains a reference is not sendable.

TypeFlags [
Experimental
]
TypeParameterDef [
Experimental
]
TypeckTables [
Experimental
]
UpvarBorrow [
Experimental
]
UpvarId [
Experimental
]

Upvars do not get their own node-id. Instead, we use the pair of the original var id (that is, the root variable that is referenced by the upvar) and the id of the closure expression.

VariantDef [
Experimental
]

Enums

AdtKind [
Experimental
]
AssociatedItemContainer [
Experimental
]
AssociatedKind [
Experimental
]
BorrowKind [
Experimental
]
BoundRegion [
Experimental
]
ClosureKind [
Experimental
]
ExistentialPredicate [
Experimental
]
FragmentInfo [
Experimental
]

Describes the fragment-state associated with a NodeId.

InferTy [
Experimental
]
InstanceDef [
Experimental
]
IntVarValue [
Experimental
]
LvaluePreference [
Experimental
]
Predicate [
Experimental
]
Region [
Experimental
]

Representation of regions.

TypeVariants [
Experimental
]
UpvarCapture [
Experimental
]

Information describing the capture of an upvar. This is computed during typeck, specifically by regionck.

Variance [
Experimental
]
VariantDiscr [
Experimental
]
Visibility [
Experimental
]

Traits

DefIdTree [
Experimental
]
Lift [
Experimental
]

A trait implemented for all X<'a> types which can be safely and efficiently converted to X<'tcx> as long as they are part of the provided TyCtxt<'tcx>. This can be done, for example, for Ty<'tcx> or &'tcx Substs<'tcx> by looking them up in their respective interners.

ToPolyTraitRef [
Experimental
]
ToPredicate [
Experimental
]

Functions

provide [
Experimental
]

Type Definitions

MethodMap [
Experimental
]
PolyEquatePredicate [
Experimental
]
PolyExistentialProjection [
Experimental
]
PolyExistentialTraitRef [
Experimental
]
PolyFnSig [
Experimental
]
PolyOutlivesPredicate [
Experimental
]
PolyProjectionPredicate [
Experimental
]
PolyRegionOutlivesPredicate [
Experimental
]
PolyTraitPredicate [
Experimental
]
PolyTraitRef [
Experimental
]
PolyTypeOutlivesPredicate [
Experimental
]
Ty [
Experimental
]
UpvarCaptureMap [
Experimental
]