Module rustc::ty [] [src]

Unstable (rustc_private)

Reexports

pub use self::ImplOrTraitItemId::*;
pub use self::Variance::*;
pub use self::DtorKind::*;
pub use self::ImplOrTraitItemContainer::*;
pub use self::BorrowKind::*;
pub use self::ImplOrTraitItem::*;
pub use self::IntVarValue::*;
pub use self::LvaluePreference::*;
pub use self::fold::TypeFoldable;
pub use self::sty::BuiltinBound::Send as BoundSend;
pub use self::sty::BuiltinBound::Sized as BoundSized;
pub use self::sty::BuiltinBound::Copy as BoundCopy;
pub use self::sty::BuiltinBound::Sync as BoundSync;
pub use self::trait_def::{TraitDef, TraitFlags};

Modules

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

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:

item_path [Unstable]
layout [Unstable]
maps [Unstable]
outlives [Unstable]
relate [Unstable]

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 [Unstable]
tls [Unstable]
trait_def [Unstable]
util [Unstable]

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

walk [Unstable]

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

wf [Unstable]

Structs

AdtDefData [Unstable]

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

AdtFlags [Unstable]
AssociatedConst [Unstable]
AssociatedType [Unstable]
BareFnTy [Unstable]
Binder [Unstable]

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).

BuiltinBounds [Unstable]
CReaderCacheKey [Unstable]
ClosureSubsts [Unstable]

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

ClosureTy [Unstable]
ClosureUpvar [Unstable]
CrateAnalysis [Unstable]

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

CtxtArenas [Unstable]

Internal storage

DebruijnIndex [Unstable]

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:

EarlyBoundRegion [Unstable]
EquatePredicate [Unstable]
ExistentialBounds [Unstable]

Bounds suitable for an existentially quantified type parameter such as those that appear in object types or closure types.

FieldDefData [Unstable]
FloatVid [Unstable]
FnSig [Unstable]

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

FreeRegion [Unstable]

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

GenericPredicates [Unstable]

Bounds on generics.

Generics [Unstable]

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

ImplHeader [Unstable]

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).

InstantiatedPredicates [Unstable]

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 [Unstable]
ItemSubsts [Unstable]

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

ItemVariances [Unstable]
Method [Unstable]
MethodCall [Unstable]

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 [Unstable]
OutlivesPredicate [Unstable]
ParamTy [Unstable]
ParameterEnvironment [Unstable]

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 [Unstable]

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

ProjectionTy [Unstable]

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

RegionParameterDef [Unstable]
RegionVid [Unstable]
SkolemizedRegionVid [Unstable]
Tables [Unstable]
TraitPredicate [Unstable]
TraitRef [Unstable]

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

TraitTy [Unstable]
TyCtxt [Unstable]

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 [Unstable]
TyVid [Unstable]
TypeAndMut [Unstable]
TypeContents [Unstable]

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 [Unstable]
TypeParameterDef [Unstable]
TypeScheme [Unstable]

A "type scheme", in ML terminology, is a type combined with some set of generic types that the type is, well, generic over. In Rust terms, it is the "type" of a fn item or struct -- this type will include various generic parameters that must be substituted when the item/struct is referenced. That is called converting the type scheme to a monotype.

UpvarBorrow [Unstable]
UpvarId [Unstable]

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.

VariantDefData [Unstable]

Enums

AdtKind [Unstable]
BorrowKind [Unstable]
BoundRegion [Unstable]
BuiltinBound [Unstable]
ClosureKind [Unstable]
DtorKind [Unstable]
ExplicitSelfCategory [Unstable]

The category of explicit self.

FnOutput [Unstable]
FragmentInfo [Unstable]

Describes the fragment-state associated with a NodeId.

ImplOrTraitItem [Unstable]
ImplOrTraitItemContainer [Unstable]
ImplOrTraitItemId [Unstable]
InferTy [Unstable]
IntVarValue [Unstable]
LvaluePreference [Unstable]
ObjectLifetimeDefault [Unstable]

Default region to use for the bound of objects that are supplied as the value for this type parameter. This is derived from T:'a annotations appearing in the type definition. If this is None, then the default is inherited from the surrounding context. See RFC #599 for details.

Predicate [Unstable]
Region [Unstable]

Representation of regions.

TypeVariants [Unstable]
UpvarCapture [Unstable]

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

Variance [Unstable]
VariantKind [Unstable]
Visibility [Unstable]

Traits

Lift [Unstable]

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.

NodeIdTree [Unstable]
ToPolyTraitRef [Unstable]
ToPredicate [Unstable]

Type Definitions

AdtDef [Unstable]
AdtDefMaster [Unstable]
Disr [Unstable]
FieldDef [Unstable]
FieldDefMaster [Unstable]
MethodMap [Unstable]
PolyEquatePredicate [Unstable]
PolyFnOutput [Unstable]
PolyFnSig [Unstable]
PolyOutlivesPredicate [Unstable]
PolyProjectionPredicate [Unstable]
PolyRegionOutlivesPredicate [Unstable]
PolyTraitPredicate [Unstable]
PolyTraitRef [Unstable]
PolyTypeOutlivesPredicate [Unstable]
Ty [Unstable]
UpvarCaptureMap [Unstable]
VariantDef [Unstable]
VariantDefMaster [Unstable]