Module rustc_typeck::middle::ty [−] [src]

Unstable

Structs

AssociatedConst [Unstable]
AssociatedType [Unstable]
AutoDerefRef [Unstable]

Represents coercing a pointer to a different kind of pointer - where 'kind' here means either or both of raw vs borrowed vs unique and fat vs thin.

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

ClosureTy [Unstable]
ClosureUpvar [Unstable]
CommonTypes [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][dbi] 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. The major difference between this case and ParamBounds is that general purpose trait bounds are omitted and there must be exactly one region.

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

Freevar [Unstable]

A free variable referred to in a function.

GenericPredicates [Unstable]

Bounds on generics.

Generics [Unstable]

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

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

An entry in the type interner.

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]
MethodObject [Unstable]
MethodParam [Unstable]
OutlivesPredicate [Unstable]
ParamBounds [Unstable]

Bounds suitable for a named type parameter like A in fn foo<A> as well as the existential type parameter in an object type.

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

As TypeScheme but for a trait ref.

TraitFlags [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:

TransmuteRestriction [Unstable]

A restriction that certain types must be the same size. The use of transmute gives rise to these restrictions. These generally cannot be checked until trans; therefore, each call to transmute will push one or more such restriction into the transmute_restrictions vector during intrinsicck. They are then checked during trans by the fn check_intrinsics.

TyS [Unstable]
TyTrait [Unstable]
TyVid [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.

VariantInfo [Unstable]
creader_cache_key [Unstable]
ctxt [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.

expected_found [Unstable]
field [Unstable]
field_ty [Unstable]
mt [Unstable]
param_index [Unstable]

Enums

AutoAdjustment [Unstable]
AutoRef [Unstable]
BorrowKind [Unstable]
BoundRegion [Unstable]
BuiltinBound [Unstable]
ClosureKind [Unstable]
CopyImplementationError [Unstable]
CustomCoerceUnsized [Unstable]
DtorKind [Unstable]
ExplicitSelfCategory [Unstable]

The category of explicit self.

ExprKind [Unstable]

We categorize expressions into three kinds. The distinction between lvalue/rvalue is fundamental to the language. The distinction between the two kinds of rvalues is an artifact of trans which reflects how we will generate code for that kind of expression. See trans/expr.rs for more information.

FnOutput [Unstable]
ImplOrTraitItem [Unstable]
ImplOrTraitItemContainer [Unstable]
ImplOrTraitItemId [Unstable]
InferRegion [Unstable]
InferTy [Unstable]
IntVarValue [Unstable]
MethodOrigin [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:

Representability [Unstable]

Describes whether a type is representable. For types that are not representable, 'SelfRecursive' and 'ContainsRecursive' are used to distinguish between types that are recursive with themselves and types that contain a different recursive type. These cases can therefore be treated differently when reporting errors.

UnconstrainedNumeric [Unstable]
UpvarCapture [Unstable]

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

Variance [Unstable]
sty [Unstable]
terr_vstore_kind [Unstable]
type_err [Unstable]
vtable_origin [Unstable]

Constants

INITIAL_DISCRIMINANT_VALUE [Unstable]

Traits

AsPredicate [Unstable]
ClosureTyper [Unstable]
HasProjectionTypes [Unstable]
ReferencesError [Unstable]
RegionEscape [Unstable]
ToPolyTraitRef [Unstable]

Functions

accumulate_lifetimes_in_type [Unstable]

Pushes all the lifetimes in the given type onto the given list. A "lifetime in a type" is a lifetime specified by a reference or a lifetime in a list of type substitutions. This does not traverse into nominal types, nor does it resolve fictitious types.

adjust_ty [Unstable]

See expr_ty_adjusted

adjust_ty_for_autoref [Unstable]
all_builtin_bounds [Unstable]
anonymize_late_bound_regions [Unstable]

Rewrite any late-bound regions so that they are anonymous. Region numbers are assigned starting at 1 and increasing monotonically in the order traversed by the fold operation.

array_element_ty [Unstable]
associated_consts [Unstable]
associated_type_parameter_index [Unstable]

Returns the parameter index that the given associated type corresponds to.

binds_late_bound_regions [Unstable]
can_type_implement_copy [Unstable]
closure_upvars [Unstable]
construct_free_substs [Unstable]

Constructs and returns a substitution that can be applied to move from the "outer" view of a type or method to the "inner" view. In general, this means converting from bound parameters to free parameters. Since we currently represent bound/free type parameters in the same way, this only has an effect on regions.

construct_parameter_environment [Unstable]

See ParameterEnvironment struct def'n for details

count_late_bound_regions [Unstable]
custom_coerce_unsized_kind [Unstable]
deref [Unstable]
each_bound_trait_and_supertraits [Unstable]
empty_builtin_bounds [Unstable]
empty_parameter_environment [Unstable]

Construct a parameter environment suitable for static contexts or other contexts where there are no free type/lifetime parameters in scope.

enum_is_univariant [Unstable]
enum_repr_type [Unstable]

Returns (normalized_type, ty), where normalized_type is the IntType representation of one of {i64,i32,i16,i8,u64,u32,u16,u8}, and ty is the original type (i.e. may include isize or usize).

enum_variant_with_id [Unstable]
enum_variants [Unstable]
erase_late_bound_regions [Unstable]

Replace any late-bound regions bound in value with 'static. Useful in trans but also method lookup and a few other places where precise region relationships are not required.

eval_repeat_count [Unstable]
expr_is_lval [Unstable]
expr_kind [Unstable]
expr_span [Unstable]
expr_ty [Unstable]
expr_ty_adjusted [Unstable]

Returns the type of expr, considering any AutoAdjustment entry recorded for that expression.

expr_ty_opt [Unstable]
field_idx_strict [Unstable]
flatten_late_bound_regions [Unstable]

Flattens two binding levels into one. So for<'a> for<'b> Foo becomes for<'a,'b> Foo.

fn_is_variadic [Unstable]
fold_ty [Unstable]
free_region_from_def [Unstable]
get_attrs [Unstable]

Get the attributes of a definition.

has_attr [Unstable]

Determine whether an item is annotated with an attribute

has_dtor [Unstable]
hash_crate_independent [Unstable]

Creates a hash of the type Ty which will be the same no matter what crate context it's calculated within. This is used by the type_id intrinsic.

impl_id_to_trait_ref [Unstable]
impl_of_method [Unstable]

If the given def ID describes a method belonging to an impl, return the ID of the impl that the method belongs to. Otherwise, return None.

impl_or_trait_item [Unstable]
impl_or_trait_item_idx [Unstable]
impl_trait_ref [Unstable]
index [Unstable]
is_associated_type [Unstable]

Returns true if the given ID refers to an associated type and false if it refers to anything else.

is_ffi_safe [Unstable]
is_fn_ty [Unstable]
is_instantiable [Unstable]
is_tuple_struct [Unstable]
is_type_representable [Unstable]

Check whether a type is representable. This means it cannot contain unboxed structural recursion. This check is needed for structs and enums.

item_path_str [Unstable]
item_variances [Unstable]
liberate_late_bound_regions [Unstable]

Replace any late-bound regions bound in value with free variants attached to scope-id scope_id.

local_var_name_str [Unstable]
lookup_field_type [Unstable]
lookup_field_type_unsubstituted [Unstable]
lookup_item_type [Unstable]
lookup_packed [Unstable]

Determine whether an item is annotated with #[repr(packed)]

lookup_predicates [Unstable]

Given the did of an item, returns its full set of predicates.

lookup_repr_hints [Unstable]

Obtain the representation annotation for a struct definition.

lookup_simd [Unstable]

Determine whether an item is annotated with #[simd]

lookup_struct_fields [Unstable]
lookup_super_predicates [Unstable]

Given the did of a trait, returns its superpredicates.

lookup_trait_def [Unstable]

Given the did of a trait, returns its canonical trait ref.

make_substs_for_receiver_types [Unstable]

Substitutes the values for the receiver's type parameters that are found in method, leaving the method's type parameters intact.

maybe_walk_ty [Unstable]

Walks ty and any types appearing within ty, invoking the callback f on each type. If the callback returns false, then the children of the current type are ignored.

mk_bare_fn [Unstable]
mk_bool [Unstable]
mk_closure [Unstable]
mk_ctor_fn [Unstable]
mk_ctxt [Unstable]
mk_enum [Unstable]
mk_float_var [Unstable]
mk_imm_ptr [Unstable]
mk_imm_rptr [Unstable]
mk_infer [Unstable]
mk_int_var [Unstable]
mk_mach_float [Unstable]
mk_mach_int [Unstable]
mk_mach_uint [Unstable]
mk_mut_ptr [Unstable]
mk_mut_rptr [Unstable]
mk_nil [Unstable]
mk_nil_ptr [Unstable]
mk_param [Unstable]
mk_param_from_def [Unstable]
mk_projection [Unstable]
mk_ptr [Unstable]
mk_rptr [Unstable]
mk_self_type [Unstable]
mk_slice [Unstable]
mk_str [Unstable]
mk_str_slice [Unstable]
mk_struct [Unstable]
mk_t [Unstable]
mk_trait [Unstable]
mk_tup [Unstable]
mk_uniq [Unstable]
mk_var [Unstable]
mk_vec [Unstable]
named_element_ty [Unstable]

Returns the type of element at field n in struct or struct-like type t. For an enum t, variant must be some def id.

no_late_bound_regions [Unstable]
node_id_item_substs [Unstable]
node_id_to_type [Unstable]
node_id_to_type_opt [Unstable]
note_and_explain_type_err [Unstable]
pat_ty [Unstable]
pat_ty_opt [Unstable]
populate_implementations_for_primitive_if_necessary [Unstable]

Load primitive inherent implementations if necessary

populate_implementations_for_trait_if_necessary [Unstable]

Populates the type context with all the implementations for the given trait if necessary.

populate_inherent_implementations_for_type_if_necessary [Unstable]

Populates the type context with all the inherent implementations for the given type if necessary.

positional_element_ty [Unstable]

Returns the type of element at index i in tuple or tuple-like type t. For an enum t, variant is None only if t is a univariant enum.

predicates [Unstable]
provided_source [Unstable]
provided_trait_methods [Unstable]
record_trait_has_default_impl [Unstable]

Records a trait-to-implementation mapping.

region_existential_bound [Unstable]

An existential bound that does not implement any traits.

replace_late_bound_regions [Unstable]

Replaces the late-bound-regions in value that are bound by value.

required_region_bounds [Unstable]

Given a set of predicates that apply to an object type, returns the region bounds that the (erased) Self type must outlive. Precisely because the Self type is erased, the parameter erased_self_ty must be supplied to indicate what type has been used to represent Self in the predicates themselves. This should really be a unique type; FreshTy(0) is a popular choice.

resolve_expr [Unstable]
sequence_element_type [Unstable]
simd_size [Unstable]
simd_type [Unstable]
sort_bounds_list [Unstable]
stmt_node_id [Unstable]
struct_fields [Unstable]
struct_lockstep_tails [Unstable]

Same as applying struct_tail on source and target, but only keeps going as long as the two types are instances of the same structure definitions. For (Foo<Foo<T>>, Foo<Trait>), the result will be (Foo<T>, Trait), whereas struct_tail produces T, and Trait, respectively.

struct_tail [Unstable]

Returns the deeply last field of nested structures, or the same type, if not a structure at all. Corresponds to the only possible unsized field, and its type can be used to determine unsizing strategy.

substd_enum_variants [Unstable]
trait_has_default_impl [Unstable]
trait_id_of_impl [Unstable]

Given the def_id of an impl, return the def_id of the trait it implements. If it implements no trait, return None.

trait_impl_polarity [Unstable]
trait_item [Unstable]
trait_item_def_ids [Unstable]
trait_item_of_item [Unstable]

If the given def ID describes an item belonging to a trait, (either a default method or an implementation of a trait method), return the ID of the method inside trait definition (this means that if the given def ID is already that of the original trait method, then the return value is the same). Otherwise, return None.

trait_items [Unstable]
trait_of_item [Unstable]

If the given def ID describes an item belonging to a trait (either a default method or an implementation of a trait method), return the ID of the trait that the method belongs to. Otherwise, return None.

trait_ref_contains_error [Unstable]
trait_ref_to_def_id [Unstable]
try_add_builtin_trait [Unstable]

Checks whether trait_ref refers to one of the builtin traits, like Send, and adds the corresponding bound to the set builtin_bounds if so. Returns true if trait_ref is a builtin trait.

tup_fields [Unstable]
ty_dtor [Unstable]
ty_fn_abi [Unstable]

Returns the ABI of the given function.

ty_fn_args [Unstable]
ty_fn_ret [Unstable]
ty_fn_sig [Unstable]
ty_region [Unstable]
ty_sort_string [Unstable]
ty_to_def_id [Unstable]
type_content [Unstable]
type_contents [Unstable]
type_err_to_str [Unstable]

Explains the source of a type err in a short, human readable way. This is meant to be placed in parentheses after some larger message. You should also invoke note_and_explain_type_err() afterwards to present additional details, particularly when it comes to lifetime-related errors.

type_escapes_depth [Unstable]
type_has_escaping_regions [Unstable]

An "escaping region" is a bound region whose binder is not part of t.

type_has_late_bound_regions [Unstable]
type_has_params [Unstable]
type_has_projection [Unstable]
type_has_self [Unstable]
type_has_ty_infer [Unstable]
type_interior_is_unsafe [Unstable]
type_is_bare_fn [Unstable]
type_is_bare_fn_item [Unstable]
type_is_bool [Unstable]
type_is_c_like_enum [Unstable]
type_is_char [Unstable]
type_is_empty [Unstable]
type_is_error [Unstable]
type_is_floating_point [Unstable]

Returns true if this type is a floating point type and false otherwise.

type_is_fp [Unstable]
type_is_fresh [Unstable]
type_is_integral [Unstable]
type_is_machine [Unstable]
type_is_nil [Unstable]
type_is_numeric [Unstable]
type_is_region_ptr [Unstable]
type_is_scalar [Unstable]
type_is_self [Unstable]
type_is_signed [Unstable]
type_is_simd [Unstable]
type_is_sized [Unstable]
type_is_structural [Unstable]
type_is_trait [Unstable]
type_is_ty_var [Unstable]
type_is_uint [Unstable]
type_is_unique [Unstable]
type_is_unsafe_ptr [Unstable]
type_is_vec [Unstable]
type_moves_by_default [Unstable]
type_needs_infer [Unstable]
type_needs_subst [Unstable]
type_trait_info [Unstable]
walk_ty [Unstable]
with_freevars [Unstable]
with_path [Unstable]

Type Definitions

BuiltinBounds [Unstable]
CaptureModeMap [Unstable]
Disr [Unstable]
FreevarMap [Unstable]
GlobMap [Unstable]
MethodMap [Unstable]
ObjectCastMap [Unstable]
PolyEquatePredicate [Unstable]
PolyFnOutput [Unstable]
PolyFnSig [Unstable]
PolyOutlivesPredicate [Unstable]
PolyProjectionPredicate [Unstable]
PolyRegionOutlivesPredicate [Unstable]
PolyTraitPredicate [Unstable]
PolyTraitRef [Unstable]
PolyTypeOutlivesPredicate [Unstable]
TraitMap [Unstable]
Ty [Unstable]
UpvarCaptureMap [Unstable]
vtable_param_res [Unstable]
vtable_res [Unstable]