Module rustc::middle::tyExperimental [-]  [+] [src]

Reexports

pub use self::terr_vstore_kind::*;
pub use self::type_err::*;
pub use self::BuiltinBound::*;
pub use self::InferTy::*;
pub use self::InferRegion::*;
pub use self::ImplOrTraitItemId::*;
pub use self::UnboxedClosureKind::*;
pub use self::TraitStore::*;
pub use self::ast_ty_to_ty_cache_entry::*;
pub use self::Variance::*;
pub use self::AutoAdjustment::*;
pub use self::Representability::*;
pub use self::UnsizeKind::*;
pub use self::AutoRef::*;
pub use self::ExprKind::*;
pub use self::DtorKind::*;
pub use self::ExplicitSelfCategory::*;
pub use self::FnOutput::*;
pub use self::Region::*;
pub use self::ImplOrTraitItemContainer::*;
pub use self::BorrowKind::*;
pub use self::ImplOrTraitItem::*;
pub use self::BoundRegion::*;
pub use self::sty::*;
pub use self::IntVarValue::*;

Structs

AssociatedType
AssociatedTypeInfo
AutoDerefRef
BareFnTy
Binder

Binder serves as a synthetic binder for lifetimes. It is used when we wish to replace the escaping higher-ranked lifetimes in a type or something else that is not itself a binder (this is because the replace_late_bound_regions function replaces all lifetimes bound by the binder supplied to it; but a type is not a binder, so you must introduce an artificial one).

ClosureTy
DebruijnIndex

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:

ExistentialBounds

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
FnSig

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

FreeRegion

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

Freevar

A free variable referred to in a function.

GenericBounds

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

Generics

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

IntVid
InternedTy

An entry in the type interner.

ItemSubsts

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

ItemVariances
Method
ParamBounds

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
ParameterEnvironment

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.

Polytype

A polytype.

RegionParameterDef
RegionVid
TraitDef

As Polytype but for a trait ref.

TraitRef

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

TransmuteRestriction

A restriction that certain types must be the same size. The use of transmute gives rise to these restrictions.

TyS
TyTrait
TyVid
TypeContents

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
TypeParameterDef
UnboxedClosure

Records information about each unboxed closure.

UnboxedClosureUpvar
UpvarBorrow

Information describing the borrowing of an upvar. This is computed during typeck, specifically by regionck. The general idea is that the compiler analyses treat closures like:

UpvarId

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
creader_cache_key
ctxt

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
field
field_ty
mt

Enums

AutoAdjustment
AutoRef
BorrowKind
BoundRegion
BuiltinBound
DtorKind
ExplicitSelfCategory

The category of explicit self.

ExprKind

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
ImplOrTraitItem
ImplOrTraitItemContainer
ImplOrTraitItemId
InferRegion
InferTy
IntVarValue
Region

Representation of regions:

Representability

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.

TraitStore
UnboxedClosureKind
UnsizeKind
Variance
ast_ty_to_ty_cache_entry
sty
terr_vstore_kind
type_err

Constants

pub const HAS_PARAMS: TypeFlags = BitFlags { bits: $value }  
pub const HAS_REGIONS: TypeFlags = BitFlags { bits: $value }  
pub const HAS_RE_INFER: TypeFlags = BitFlags { bits: $value }  
pub const HAS_RE_LATE_BOUND: TypeFlags = BitFlags { bits: $value }  
pub const HAS_SELF: TypeFlags = BitFlags { bits: $value }  
pub const HAS_TY_ERR: TypeFlags = BitFlags { bits: $value }  
pub const HAS_TY_INFER: TypeFlags = BitFlags { bits: $value }  
pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0  
pub const NEEDS_SUBST: TypeFlags = BitFlags { bits: $value }  
pub const NO_TYPE_FLAGS: TypeFlags = BitFlags { bits: $value }  

Functions

accumulate_lifetimes_in_type

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_is_object
adjust_ty

See expr_ty_adjusted

adjust_ty_for_autoref
adjusted_object_region
all_builtin_bounds
array_element_ty
associated_type_parameter_index

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

bind
bounds_for_trait_ref

Given a reference to a trait, returns the bounds declared on the trait, with appropriate substitutions applied.

close_type
construct_parameter_environment

See ParameterEnvironment struct def'n for details

deref
each_attr

Iterate over attributes of a definition.

each_bound_trait_and_supertraits
empty_builtin_bounds
empty_parameter_environment

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

enum_is_univariant
enum_variant_with_id
enum_variants
erase_late_bound_regions

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
expr_is_lval
expr_kind
expr_span
expr_ty
expr_ty_adjusted

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

expr_ty_opt
field_idx_strict
fn_is_variadic
fold_ty
free_region_from_def
get_tydesc_ty
has_attr

Determine whether an item is annotated with an attribute

has_dtor
hash_crate_independent

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_of_method

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
impl_or_trait_item_idx
impl_trait_ref
index
is_associated_type

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

is_binopable
is_ffi_safe
is_fn_ty
is_instantiable
is_tuple_struct
is_type_representable

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
item_variances
liberate_late_bound_regions

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

lltype_is_sized
local_var_name_str
lookup_field_type
lookup_item_type
lookup_packed

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

lookup_repr_hints

Obtain the representation annotation for a struct definition.

lookup_simd

Determine whether an item is annotated with #[simd]

lookup_struct_fields
lookup_trait_def

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

maybe_walk_ty
mk_bare_fn
mk_bool
mk_char
mk_closure
mk_ctor_fn
mk_ctxt
mk_enum
mk_err
mk_f32
mk_f64
mk_float_var
mk_i16
mk_i32
mk_i64
mk_i8
mk_imm_ptr
mk_imm_rptr
mk_infer
mk_int
mk_int_var
mk_mach_float
mk_mach_int
mk_mach_uint
mk_mut_ptr
mk_mut_rptr
mk_nil
mk_nil_ptr
mk_open
mk_param
mk_param_from_def
mk_prim_t
mk_ptr
mk_rptr
mk_self_type
mk_slice
mk_str
mk_str_slice
mk_struct
mk_t
mk_trait
mk_tup
mk_u16
mk_u32
mk_u64
mk_u8
mk_uint
mk_unboxed_closure
mk_uniq
mk_var
mk_vec
node_id_item_substs
node_id_to_trait_ref
node_id_to_type
node_id_to_type_opt
normalize_ty

Returns an equivalent type with all the typedefs and self regions removed.

note_and_explain_type_err
pat_ty
populate_implementations_for_trait_if_necessary

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

populate_implementations_for_type_if_necessary

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

provided_source
provided_trait_methods
record_trait_implementation

Records a trait-to-implementation mapping.

region_existential_bound

An existential bound that does not implement any traits.

replace_late_bound_regions

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

required_region_bounds

Given a type which must meet the builtin bounds and trait bounds, returns a set of lifetimes which the type must outlive.

resolve_expr
sequence_element_type
simd_size
simd_type
stmt_node_id
struct_fields
substd_enum_variants
trait_id_of_impl

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

trait_item
trait_item_def_ids
trait_item_of_item

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
trait_of_item

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
trait_ref_to_def_id
try_add_builtin_trait

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.

try_node_id_to_type
tup_fields
ty_closure_store
ty_dtor
ty_fn_abi

Returns the ABI of the given function.

ty_fn_args
ty_fn_ret
ty_fn_sig
ty_region
ty_sort_string
ty_to_def_id
type_content
type_contents
type_err_to_str

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
type_has_escaping_regions

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

type_has_late_bound_regions
type_has_params
type_has_self
type_has_ty_infer
type_interior_is_unsafe
type_is_bare_fn
type_is_bool
type_is_c_like_enum
type_is_char
type_is_empty
type_is_error
type_is_fat_ptr
type_is_floating_point

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

type_is_fp
type_is_integral
type_is_machine
type_is_nil
type_is_numeric
type_is_region_ptr
type_is_scalar
type_is_self
type_is_signed
type_is_simd
type_is_sized
type_is_skolemized
type_is_structural
type_is_trait
type_is_ty_var
type_is_uint
type_is_unique
type_is_unsafe_ptr
type_is_vec
type_moves_by_default
type_needs_drop
type_needs_infer
type_needs_subst
type_needs_unwind_cleanup
type_of_adjust
type_trait_info
unboxed_closure_upvars
unopen_type
unsize_ty
unsized_part_of_type
walk_ty
with_freevars
with_path

Type Definitions

BuiltinBounds
CaptureModeMap
Disr
FreevarMap
Ty
UpvarBorrowMap