[][src]Module rustc::ty

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Re-exports

pub use self::Variance::*;
pub use self::AssocItemContainer::*;
pub use self::BorrowKind::*;
pub use self::IntVarValue::*;
pub use self::fold::TypeFoldable;
pub use self::sty::BoundRegion::*;
pub use self::sty::InferTy::*;
pub use self::sty::RegionKind::*;
pub use self::sty::TyKind::*;
pub use self::binding::BindingMode;
pub use self::binding::BindingMode::*;
pub use self::trait_def::TraitDef;
pub use self::query::queries;

Modules

_matchInternal
adjustmentInternal
bindingInternal
castInternal
codecInternal
constnessInternal
contextInternal

Type context book-keeping.

erase_regionsInternal
errorInternal
fast_rejectInternal
flagsInternal
foldInternal

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:

inhabitednessInternal
instanceInternal
layoutInternal
outlivesInternal
printInternal
queryInternal
relateInternal

Generalized type relating mechanism.

stealInternal
structural_implsInternal

This module contains implements of the Lift and TypeFoldable traits for various types in the Rust compiler. Most are written by hand, though we've recently added some macros (e.g., BraceStructLiftImpl!) to help with the tedium.

styInternal

This module contains TyKind and its major components.

substInternal
tlsInternal
trait_defInternal
utilInternal

Miscellaneous type-system utilities that are too small to deserve their own modules.

walkInternal

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

wfInternal

Structs

AdtDefInternal

The definition of a user-defined type, e.g., a struct, enum, or union.

AdtFlagsInternal
AdtSizedConstraintInternal
AllArenasInternal
AssocItemInternal
AssocItemsIteratorInternal
BinderInternal

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 type PolyTraitRef == Binder<TraitRef>). Note that when we instantiate, erase, or otherwise "discharge" these bound vars, we change the type from Binder<T> to just T (see e.g., liberate_late_bound_regions).

BoundTyInternal
BoundVarInternal
CReaderCacheKeyInternal
CanonicalUserTypeAnnotationInternal
ClosureSubstsInternal

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

ClosureUpvarInternal
ConstInternal

Typed constant value.

ConstVidInternal
CrateInherentImplsInternal

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

CratePredicatesMapInternal

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 tcx.inferred_outlives_of() to get the outlives for a particular item.

CrateVariancesMapInternal

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 tcx.variances_of() to get the variance for a particular item.

CtxtInternersInternal
DebruijnIndexInternal

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:

DestructorInternal
EarlyBoundRegionInternal
ExistentialProjectionInternal

A ProjectionPredicate for an ExistentialTraitRef.

ExistentialTraitRefInternal

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

FieldDefInternal
FloatVarValueInternal
FloatVidInternal
FnSigInternal

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

FreeRegionInternal

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

FreeRegionInfoInternal
GenSigInternal
GeneratorSubstsInternal

Similar to ClosureSubsts; see the above documentation for more.

GenericParamCountInternal
GenericParamDefInternal
GenericPredicatesInternal

Bounds on generics.

GenericsInternal

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

GlobalCtxtInternal
ImplHeaderInternal

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

InstanceInternal
InstantiatedPredicatesInternal

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.

IntVidInternal
ListInternal

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. Note: Slice was already taken by the Ty.

OutlivesPredicateInternal
ParamConstInternal
ParamEnvInternal

When type checking, we use the ParamEnv to track details about the set of where-clauses that are in scope at this particular point.

ParamEnvAndInternal
ParamTyInternal
PlaceholderInternal

The "placeholder index" fully defines a placeholder region. Placeholder regions are identified by both a universe as well as a "bound-region" within that universe. The bound_region is basically a name -- distinct bound regions within the same universe are just two regions with an unknown relationship to one another.

ProjectionPredicateInternal

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

ProjectionTyInternal

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

RegionVidInternal
ReprFlagsInternal
ReprOptionsInternal

Represents the repr options provided by the user,

ResolutionsInternal
ResolvedOpaqueTyInternal

All information necessary to validate and reveal an impl Trait.

SubtypePredicateInternal
SymbolNameInternal
TraitPredicateInternal
TraitRefInternal

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

TyCtxtInternal

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 guide for more details.

TySInternal
TyVidInternal
TypeAndMutInternal
TypeFlagsInternal
TypeckTablesInternal
UniverseIndexInternal

"Universes" are used during type- and trait-checking in the presence of for<..> binders to control what sets of names are visible. Universes are arranged into a tree: the root universe contains names that are always visible. Each child then adds a new set of names that are visible, in addition to those of its parent. We say that the child universe "extends" the parent universe with new names.

UpvarBorrowInternal
UpvarIdInternal

Upvars do not get their own NodeId. 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.

UpvarPathInternal
UserTypeAnnotationIndexInternal
VariantDefInternal

Definition of a variant -- a struct's fields or a enum variant.

VariantFlagsInternal

Enums

AdtKindInternal
AssocItemContainerInternal
AssocKindInternal
AttributesInternal
BorrowKindInternal
BoundRegionInternal
BoundTyKindInternal
ClosureKindInternal

Represents the various closure traits in the language. This will determine the type of the environment (self, in the desugaring) argument that the closure expects.

ExistentialPredicateInternal
GenericParamDefKindInternal
ImplOverlapKindInternal
InferConstInternal

An inference variable for a const, for use in const generics.

InferTyInternal
InstanceDefInternal
IntVarValueInternal
PredicateInternal
RegionKindInternal

Representation of regions.

TyKindInternal

N.B., if you change this, you'll probably want to change the corresponding AST structure in libsyntax/ast.rs as well.

UpvarCaptureInternal

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

UpvarSubstsInternal
UserTypeInternal

A user-given type annotation attached to a constant. These arise from constants that are named via paths, like Foo::<A>::new and so forth.

VarianceInternal
VariantDiscrInternal
VisibilityInternal
WalkTysIterInternal

Constants

INNERMOSTInternal
_Internal

Traits

DefIdTreeInternal
LiftInternal

A trait implemented for all X<'a> types that 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 SubstsRef<'tcx> by looking them up in their respective interners.

ToPolyTraitRefInternal
ToPredicateInternal

Functions

adt_sized_constraintInternal

Calculates the Sized constraint.

associated_itemInternal
associated_item_def_idsInternal
crate_disambiguatorInternal
crate_hashInternal
def_spanInternal
instance_def_size_estimateInternal
is_impl_trait_defnInternal

Yields the parent function's DefId if def_id is an impl Trait definition.

issue33140_self_tyInternal

If def_id is an issue 33140 hack impl, returns its self type; otherwise, returns None.

keep_localInternal
original_crate_nameInternal
param_envInternal

See ParamEnv struct definition for details.

provideInternal
trait_of_itemInternal

If the given DefId describes an item belonging to a trait, returns the DefId of the trait that the trait item belongs to; otherwise, returns None.

Type Definitions

CanonicalPolyFnSigInternal
CanonicalTyInternal
CanonicalUserTypeInternal

Canonicalized user type annotation.

CanonicalUserTypeAnnotationsInternal

Mapping of type annotation indices to canonical user type annotations.

PlaceholderConstInternal
PlaceholderRegionInternal
PlaceholderTypeInternal
PolyExistentialProjectionInternal
PolyExistentialTraitRefInternal
PolyFnSigInternal
PolyGenSigInternal
PolyOutlivesPredicateInternal
PolyProjectionPredicateInternal
PolyRegionOutlivesPredicateInternal
PolySubtypePredicateInternal
PolyTraitPredicateInternal
PolyTraitRefInternal
PolyTypeOutlivesPredicateInternal
RegionInternal
RegionOutlivesPredicateInternal
TyInternal
TypeOutlivesPredicateInternal
UpvarCaptureMapInternal
UpvarListMapInternal

Foreign Types

OpaqueListContentsInternal

A dummy type used to force List to by unsized without requiring fat pointers.