Module rustc::middle::ty[src]

Structs

AutoDerefRef
BareFnTy
ClosureTy
FloatVid
FnSig

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

FreeRegion
Generics

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

IntVid
ItemSubsts

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

ItemVariances
Method
ParamBounds
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
TransmuteRestriction

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

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.

TypeParameterDef
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
intern_key
mt
t
t_box_

Enums

AutoAdjustment
AutoRef
BorrowKind
BoundRegion
BuiltinBound
DtorKind
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.

InferRegion
InferTy
IntVarValue
MethodContainer
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
Variance
ast_ty_to_ty_cache_entry
sty
tbox_flag
terr_vstore_kind
type_err

Statics

pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0  

Traits

ExprTyProvider

Functions

adjust_ty

See expr_ty_adjusted

all_builtin_bounds
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
enum_is_univariant
enum_variant_with_id
enum_variants
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
get_opaque_ty
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 t 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_trait_ref
index
is_binopable
is_fn_ty
is_instantiable
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
local_var_name_str
lookup_field_type
lookup_impl_vtables
lookup_item_type
lookup_packed

Determine whether an item is annotated with #[packed]

lookup_repr_hint
lookup_simd

Determine whether an item is annotated with #[simd]

lookup_struct_field
lookup_struct_fields
lookup_trait_def

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

maybe_walk_ty
method
method_call_type_param_defs
method_idx
mk_bare_fn
mk_bool
mk_bot
mk_box
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_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_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
param_tys_in_type

Returns a vector containing the indices of all type parameters that appear in ty. The vector may contain duplicates. Probably should be converted to a bitset or some other representation.

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.

resolve_expr
sequence_element_type
simd_size
simd_type
stmt_node_id
struct_fields
substd_enum_variants
tbox_has_flag
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_method
trait_method_def_ids
trait_method_of_method

If the given def ID describes a method 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_methods
trait_of_method

If the given def ID describes a method 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_supertraits
trait_ref_to_def_id
trait_supertraits
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
ty_closure_store
ty_dtor
ty_fn_args
ty_fn_ret
ty_fn_sig
ty_region
ty_sort_str
ty_to_def_id
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_has_params
type_has_self
type_id
type_interior_is_unsafe
type_is_bare_fn
type_is_bool
type_is_bot
type_is_boxed
type_is_c_like_enum
type_is_char
type_is_empty
type_is_error
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_sendable
type_is_signed
type_is_simd
type_is_sized
type_is_static
type_is_structural
type_is_trait
type_is_ty_var
type_is_uint
type_is_unique
type_is_unsafe_ptr
type_moves_by_default
type_needs_drop
type_needs_infer
type_needs_subst
type_needs_unwind_cleanup
visitor_object_ty
walk_regions_and_ty
walk_ty
with_path

Type Definitions

BuiltinBounds
Disr
UpvarBorrowMap
creader_cache
node_type_table
t_box
type_cache