Struct rustc::middle::ty::ctxt[src]

pub struct ctxt {
    pub interner: RefCell<FnvHashMap<intern_key, Box<t_box_>>>,
    pub next_id: Cell<uint>,
    pub sess: Session,
    pub def_map: DefMap,
    pub named_region_map: NamedRegionMap,
    pub region_maps: RegionMaps,
    pub node_types: node_type_table,
    pub item_substs: RefCell<NodeMap<ItemSubsts>>,
    pub methods: RefCell<DefIdMap<Rc<Method>>>,
    pub trait_method_def_ids: RefCell<DefIdMap<Rc<Vec<DefId>>>>,
    pub trait_methods_cache: RefCell<DefIdMap<Rc<Vec<Rc<Method>>>>>,
    pub impl_trait_cache: RefCell<DefIdMap<Option<Rc<TraitRef>>>>,
    pub trait_refs: RefCell<NodeMap<Rc<TraitRef>>>,
    pub trait_defs: RefCell<DefIdMap<Rc<TraitDef>>>,
    pub map: Map,
    pub intrinsic_defs: RefCell<DefIdMap<t>>,
    pub freevars: RefCell<freevar_map>,
    pub tcache: type_cache,
    pub rcache: creader_cache,
    pub short_names_cache: RefCell<HashMap<t, String>>,
    pub needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
    pub tc_cache: RefCell<HashMap<uint, TypeContents>>,
    pub ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
    pub enum_var_cache: RefCell<DefIdMap<Rc<Vec<Rc<VariantInfo>>>>>,
    pub ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
    pub adjustments: RefCell<NodeMap<AutoAdjustment>>,
    pub normalized_cache: RefCell<HashMap<t, t>>,
    pub lang_items: LanguageItems,
    pub provided_method_sources: RefCell<DefIdMap<DefId>>,
    pub supertraits: RefCell<DefIdMap<Rc<Vec<Rc<TraitRef>>>>>,
    pub superstructs: RefCell<DefIdMap<Option<DefId>>>,
    pub struct_fields: RefCell<DefIdMap<Rc<Vec<field_ty>>>>,
    pub item_variance_map: RefCell<DefIdMap<Rc<ItemVariances>>>,
    pub destructor_for_type: RefCell<DefIdMap<DefId>>,
    pub destructors: RefCell<DefIdSet>,
    pub trait_impls: RefCell<DefIdMap<Rc<RefCell<Vec<DefId>>>>>,
    pub inherent_impls: RefCell<DefIdMap<Rc<RefCell<Vec<DefId>>>>>,
    pub impl_methods: RefCell<DefIdMap<Vec<DefId>>>,
    pub used_unsafe: RefCell<NodeSet>,
    pub used_mut_nodes: RefCell<NodeSet>,
    pub impl_vtables: impl_vtable_map,
    pub populated_external_types: RefCell<DefIdSet>,
    pub populated_external_traits: RefCell<DefIdSet>,
    pub upvar_borrow_map: RefCell<UpvarBorrowMap>,
    pub extern_const_statics: RefCell<DefIdMap<Option<Gc<Expr>>>>,
    pub extern_const_variants: RefCell<DefIdMap<Option<Gc<Expr>>>>,
    pub method_map: MethodMap,
    pub vtable_map: vtable_map,
    pub dependency_formats: RefCell<Dependencies>,
    pub node_lint_levels: RefCell<HashMap<(NodeId, LintId), LevelSource>>,
    pub transmute_restrictions: RefCell<Vec<TransmuteRestriction>>,
    pub stability: RefCell<Index>,
}

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.

Fields

interner

Specifically use a speedy hash algorithm for this hash map, it's used quite often.

next_id
sess
def_map
named_region_map
region_maps
node_types

Stores the types for various nodes in the AST. Note that this table is not guaranteed to be populated until after typeck. See typeck::check::fn_ctxt for details.

item_substs

Stores the type parameters which were substituted to obtain the type of this node. This only applies to nodes that refer to entities param<eterized by type parameters, such as generic fns, types, or other items.

methods

Maps from a method to the method "descriptor"

trait_method_def_ids

Maps from a trait def-id to a list of the def-ids of its methods

trait_methods_cache

A cache for the trait_methods() routine

impl_trait_cache
trait_refs
trait_defs
map
intrinsic_defs
freevars
tcache
rcache
short_names_cache
needs_unwind_cleanup_cache
tc_cache
ast_ty_to_ty_cache
enum_var_cache
ty_param_defs
adjustments
normalized_cache
lang_items
provided_method_sources

A mapping of fake provided method def_ids to the default implementation

supertraits
superstructs
struct_fields
item_variance_map

Maps from def-id of a type or region parameter to its (inferred) variance.

destructor_for_type

A mapping from the def ID of an enum or struct type to the def ID of the method that implements its destructor. If the type is not present in this map, it does not have a destructor. This map is populated during the coherence phase of typechecking.

destructors

A method will be in this list if and only if it is a destructor.

trait_impls

Maps a trait onto a list of impls of that trait.

inherent_impls

Maps a DefId of a type to a list of its inherent impls. Contains implementations of methods that are inherent to a type. Methods in these implementations don't need to be exported.

impl_methods

Maps a DefId of an impl to a list of its methods. Note that this contains all of the impls that we know about, including ones in other crates. It's not clear that this is the best way to do it.

used_unsafe

Set of used unsafe nodes (functions or blocks). Unsafe nodes not present in this set can be warned about.

used_mut_nodes

Set of nodes which mark locals as mutable which end up getting used at some point. Local variable definitions not in this set can be warned about.

impl_vtables

vtable resolution information for impl declarations

populated_external_types

The set of external nominal types whose implementations have been read. This is used for lazy resolution of methods.

populated_external_traits

The set of external traits whose implementations have been read. This is used for lazy resolution of traits.

upvar_borrow_map

Borrows

extern_const_statics

These two caches are used by const_eval when decoding external statics and variants that are found.

extern_const_variants
method_map
vtable_map
dependency_formats
node_lint_levels
transmute_restrictions

The types that must be asserted to be the same size for transmute to be valid. We gather up these restrictions in the intrinsicck pass and check them in trans.

stability

Maps any item's def-id to its stability index.

Trait Implementations

impl ExprTyProvider for ctxt

fn expr_ty(&self, ex: &Expr) -> t

fn ty_ctxt<'a>(&'a self) -> &'a ctxt

impl Typer for ctxt

fn tcx<'a>(&'a self) -> &'a ctxt

fn node_ty(&self, id: NodeId) -> McResult<t>

fn node_method_ty(&self, method_call: MethodCall) -> Option<t>

fn adjustments<'a>(&'a self) -> &'a RefCell<NodeMap<AutoAdjustment>>

fn is_method_call(&self, id: NodeId) -> bool

fn temporary_scope(&self, rvalue_id: NodeId) -> Option<NodeId>

fn upvar_borrow(&self, upvar_id: UpvarId) -> UpvarBorrow