Struct rustc::ty::TyCtxt
[−]
[src]
pub struct TyCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { // some fields omitted }
rustc_private
)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.
Methods
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn note_and_explain_region(self, err: &mut DiagnosticBuilder, prefix: &str, region: Region, suffix: &str)
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx>
[src]
fn infer_ctxt(self, tables: Option<Tables<'tcx>>, param_env: Option<ParameterEnvironment<'gcx>>, projection_mode: ProjectionMode) -> InferCtxtBuilder<'a, 'gcx, 'tcx>
fn normalizing_infer_ctxt(self, projection_mode: ProjectionMode) -> InferCtxtBuilder<'a, 'gcx, 'tcx>
fn borrowck_fake_infer_ctxt(self, param_env: ParameterEnvironment<'gcx>) -> InferCtxt<'a, 'gcx, 'gcx>
rustc_private
)Fake InferCtxt with the global tcx. Used by pre-MIR borrowck for MemCategorizationContext/ExprUseVisitor. If any inference functionality is used, ICEs will occur.
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx>
[src]
fn normalize_associated_type<T>(self, value: &T) -> T where T: TransNormalize<'tcx>
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn prohibit_type_params(self, segments: &[PathSegment])
fn prohibit_projection(self, span: Span)
fn prim_ty_to_ty(self, segments: &[PathSegment], nty: PrimTy) -> Ty<'tcx>
fn ast_ty_to_prim_ty(self, ast_ty: &Ty) -> Option<Ty<'tcx>>
rustc_private
)If a type in the AST is a primitive type, return the ty::Ty corresponding to it.
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx>
[src]
fn lookup_stability(self, id: DefId) -> Option<&'tcx Stability>
rustc_private
)Lookup the stability for a node, loading external crate metadata as necessary.
fn lookup_deprecation(self, id: DefId) -> Option<Deprecation>
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn recursive_type_with_infinite_size_error(self, type_def_id: DefId) -> DiagnosticBuilder<'tcx>
fn report_object_safety_error(self, span: Span, trait_def_id: DefId, warning_node_id: Option<NodeId>, violations: Vec<ObjectSafetyViolation>) -> Option<DiagnosticBuilder<'tcx>>
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn is_object_safe(self, trait_def_id: DefId) -> bool
fn astconv_object_safety_violations(self, trait_def_id: DefId) -> Vec<ObjectSafetyViolation<'tcx>>
rustc_private
)Returns the object safety violations that affect
astconv - currently, Self in supertraits. This is needed
because object_safety_violations
can't be used during
type collection.
fn object_safety_violations(self, trait_def_id: DefId) -> Vec<ObjectSafetyViolation<'tcx>>
fn is_vtable_safe_method(self, trait_def_id: DefId, method: &Method<'tcx>) -> bool
rustc_private
)We say a method is vtable safe if it can be invoked on a trait
object. Note that object-safe traits can have some
non-vtable-safe methods, so long as they require Self:Sized
or
otherwise ensure that they cannot be used when Self=Trait
.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn trait_ref_for_builtin_bound(self, builtin_bound: BuiltinBound, param_ty: Ty<'tcx>) -> Result<TraitRef<'tcx>, ErrorReported>
fn predicate_for_trait_def(self, cause: ObligationCause<'tcx>, trait_def_id: DefId, recursion_depth: usize, param_ty: Ty<'tcx>, ty_params: Vec<Ty<'tcx>>) -> PredicateObligation<'tcx>
fn predicate_for_builtin_bound(self, cause: ObligationCause<'tcx>, builtin_bound: BuiltinBound, recursion_depth: usize, param_ty: Ty<'tcx>) -> Result<PredicateObligation<'tcx>, ErrorReported>
fn upcast_choices(self, source_trait_ref: PolyTraitRef<'tcx>, target_trait_def_id: DefId) -> Vec<PolyTraitRef<'tcx>>
rustc_private
)Cast a trait reference into a reference to one of its super
traits; returns None
if target_trait_def_id
is not a
supertrait.
fn count_own_vtable_entries(self, trait_ref: PolyTraitRef<'tcx>) -> usize
rustc_private
)Given a trait trait_ref
, returns the number of vtable entries
that come from trait_ref
, excluding its supertraits. Used in
computing the vtable base for an upcast trait of a trait object.
fn get_vtable_index_of_object_method<N>(self, object: &VtableObjectData<'tcx, N>, method_def_id: DefId) -> usize
rustc_private
)Given an upcast trait object described by object
, returns the
index of the method method_def_id
(which should be part of
object.upcast_trait_ref
) within the vtable for object
.
fn closure_trait_ref_and_return_type(self, fn_trait_def_id: DefId, self_ty: Ty<'tcx>, sig: &PolyFnSig<'tcx>, tuple_arguments: TupleArgumentsFlag) -> Binder<(TraitRef<'tcx>, Ty<'tcx>)>
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn note_and_explain_type_err(self, db: &mut DiagnosticBuilder, err: &TypeError<'tcx>, sp: Span)
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn collect_regions<T>(self, value: &T, region_set: &mut FnvHashSet<Region>) -> bool where T: TypeFoldable<'tcx>
rustc_private
)Collects the free and escaping regions in value
into region_set
. Returns
whether any late-bound regions were skipped
fn fold_regions<T, F>(self, value: &T, skipped_regions: &mut bool, f: F) -> T where F: FnMut(Region, u32) -> Region, T: TypeFoldable<'tcx>
rustc_private
)Folds the escaping and free regions in value
using f
, and
sets skipped_regions
to true if any late-bound region was found
and skipped.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn replace_late_bound_regions<T, F>(self, value: &Binder<T>, f: F) -> (T, FnvHashMap<BoundRegion, Region>) where F: FnMut(BoundRegion) -> Region, T: TypeFoldable<'tcx>
fn liberate_late_bound_regions<T>(self, all_outlive_scope: CodeExtent, value: &Binder<T>) -> T where T: TypeFoldable<'tcx>
rustc_private
)Replace any late-bound regions bound in value
with free variants attached to scope-id
scope_id
.
fn flatten_late_bound_regions<T>(self, bound2_value: &Binder<Binder<T>>) -> Binder<T> where T: TypeFoldable<'tcx>
rustc_private
)Flattens two binding levels into one. So for<'a> for<'b> Foo
becomes for<'a,'b> Foo
.
fn no_late_bound_regions<T>(self, value: &Binder<T>) -> Option<T> where T: TypeFoldable<'tcx>
fn collect_constrained_late_bound_regions<T>(&self, value: &Binder<T>) -> FnvHashSet<BoundRegion> where T: TypeFoldable<'tcx>
rustc_private
)Returns a set of all late-bound regions that are constrained
by value
, meaning that if we instantiate those LBR with
variables and equate value
with something else, those
variables will also be equated.
fn collect_referenced_late_bound_regions<T>(&self, value: &Binder<T>) -> FnvHashSet<BoundRegion> where T: TypeFoldable<'tcx>
rustc_private
)Returns a set of all late-bound regions that appear in value
anywhere.
fn erase_late_bound_regions<T>(self, value: &Binder<T>) -> T where T: TypeFoldable<'tcx>
rustc_private
)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.
fn anonymize_late_bound_regions<T>(self, sig: &Binder<T>) -> Binder<T> where T: TypeFoldable<'tcx>
rustc_private
)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.
The chief purpose of this function is to canonicalize regions so that two
FnSig
s or TraitRef
s which are equivalent up to region naming will become
structurally identical. For example, for<'a, 'b> fn(&'a isize, &'b isize)
and
for<'a, 'b> fn(&'b isize, &'a isize)
will become identical after anonymization.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn erase_regions<T>(self, value: &T) -> T where T: TypeFoldable<'tcx>
rustc_private
)Returns an equivalent value with all free regions removed (note that late-bound regions remain, because they are important for subtyping, but they are anonymized and normalized as well)..
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn item_path_str(self, def_id: DefId) -> String
rustc_private
)Returns a string identifying this def-id. This string is suitable for user output. It is relative to the current crate root.
fn node_path_str(self, id: NodeId) -> String
rustc_private
)Returns a string identifying this local node-id.
fn absolute_item_path_str(self, def_id: DefId) -> String
rustc_private
)Returns a string identifying this def-id. This string is suitable for user output. It always begins with a crate identifier.
fn push_krate_path<T>(self, buffer: &mut T, cnum: CrateNum) where T: ItemPathBuffer
rustc_private
)Returns the "path" to a particular crate. This can proceed in
various ways, depending on the root_mode
of the buffer
.
(See RootMode
enum for more details.)
fn try_push_visible_item_path<T>(self, buffer: &mut T, external_def_id: DefId) -> bool where T: ItemPathBuffer
rustc_private
)If possible, this pushes a global path resolving to external_def_id
that is visible
from at least one local module and returns true. If the crate defining external_def_id
is
declared with an extern crate
, the path is guarenteed to use the extern crate
.
fn push_item_path<T>(self, buffer: &mut T, def_id: DefId) where T: ItemPathBuffer
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn pat_contains_ref_binding(self, pat: &Pat) -> Option<Mutability>
fn arm_contains_ref_binding(self, arm: &Arm) -> Option<Mutability>
fn positional_element_ty(self, ty: Ty<'tcx>, i: usize, variant: Option<DefId>) -> Option<Ty<'tcx>>
rustc_private
)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.
fn named_element_ty(self, ty: Ty<'tcx>, n: Name, variant: Option<DefId>) -> Option<Ty<'tcx>>
rustc_private
)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.
fn enum_repr_type(self, opt_hint: Option<&ReprAttr>) -> IntType
rustc_private
)Returns the IntType representation.
This used to ensure int_ty
doesn't contain usize
and isize
by converting them to their actual types. That doesn't happen anymore.
fn struct_tail(self, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)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.
fn struct_lockstep_tails(self, source: Ty<'tcx>, target: Ty<'tcx>) -> (Ty<'tcx>, Ty<'tcx>)
rustc_private
)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.
fn required_region_bounds(self, erased_self_ty: Ty<'tcx>, predicates: Vec<Predicate<'tcx>>) -> Vec<Region>
rustc_private
)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.
NB: in some cases, particularly around higher-ranked bounds,
this function returns a kind of conservative approximation.
That is, all regions returned by this function are definitely
required, but there may be other region bounds that are not
returned, as well as requirements like for<'a> T: 'a
.
Requires that trait definitions have been processed so that we can elaborate predicates and walk supertraits.
fn hash_crate_independent(self, ty: Ty<'tcx>, svh: &Svh) -> u64
rustc_private
)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.
fn is_adt_dtorck(self, adt: AdtDef) -> bool
rustc_private
)Returns true if this ADT is a dtorck type.
Invoking the destructor of a dtorck type during usual cleanup
(e.g. the glue emitted for stack unwinding) requires all
lifetimes in the type-structure of adt
to strictly outlive
the adt value itself.
If adt
is not dtorck, then the adt's destructor can be
invoked even when there are lifetimes in the type-structure of
adt
that do not strictly outlive the adt value itself.
(This allows programs to make cyclic structures without
resorting to unasfe means; see RFCs 769 and 1238).
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn crate_name(self, cnum: CrateNum) -> InternedString
fn crate_disambiguator(self, cnum: CrateNum) -> InternedString
fn def_index_for_def_key(self, krate: CrateNum, key: DefKey) -> Option<DefIndex>
rustc_private
)Given a def-key key
and a crate krate
, finds the def-index
that krate
assigned to key
. This DefIndex
will always be
relative to krate
.
Returns None
if there is no DefIndex
with that key.
fn retrace_path(self, path: &DefPath) -> Option<DefId>
fn type_parameter_def(self, node_id: NodeId) -> TypeParameterDef<'tcx>
fn node_types(self) -> Ref<'a, NodeMap<Ty<'tcx>>>
fn node_type_insert(self, id: NodeId, ty: Ty<'gcx>)
fn intern_trait_def(self, def: TraitDef<'gcx>) -> &'gcx TraitDef<'gcx>
fn alloc_trait_def(self, def: TraitDef<'gcx>) -> &'gcx TraitDef<'gcx>
fn intern_adt_def(self, did: DefId, kind: AdtKind, variants: Vec<VariantDefData<'gcx, 'gcx>>) -> AdtDefMaster<'gcx>
fn intern_stability(self, stab: Stability) -> &'gcx Stability
fn intern_layout(self, layout: Layout) -> &'gcx Layout
fn store_free_region_map(self, id: NodeId, map: FreeRegionMap)
fn free_region_map(self, id: NodeId) -> FreeRegionMap
fn lift<T: ?Sized + Lift<'tcx>>(self, value: &T) -> Option<T::Lifted>
fn lift_to_global<T: ?Sized + Lift<'gcx>>(self, value: &T) -> Option<T::Lifted>
rustc_private
)Like lift, but only tries in the global tcx.
fn create_and_enter<F, R>(s: &'tcx Session, arenas: &'tcx CtxtArenas<'tcx>, def_map: RefCell<DefMap>, named_region_map: NamedRegionMap, map: Map<'tcx>, freevars: FreevarMap, maybe_unused_trait_imports: NodeSet, region_maps: RegionMaps, lang_items: LanguageItems, stability: Index<'tcx>, crate_name: &str, f: F) -> R where F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'tcx>) -> R
rustc_private
)Create a type context and call the closure with a TyCtxt
reference
to the context. The closure enforces that the type context and any interned
value (types, substs, etc.) can only be used while ty::tls
has a valid
reference to the context, to allow formatting values that need it.
impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx>
[src]
fn print_debug_stats(self)
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn mk_bare_fn(self, v: BareFnTy<'tcx>) -> &'tcx BareFnTy<'tcx>
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn safe_to_unsafe_fn_ty(self, bare_fn: &BareFnTy<'tcx>) -> Ty<'tcx>
rustc_private
)Create an unsafe fn ty based on a safe fn ty.
fn mk_ty(self, st: TypeVariants<'tcx>) -> Ty<'tcx>
fn mk_mach_int(self, tm: IntTy) -> Ty<'tcx>
fn mk_mach_uint(self, tm: UintTy) -> Ty<'tcx>
fn mk_mach_float(self, tm: FloatTy) -> Ty<'tcx>
fn mk_str(self) -> Ty<'tcx>
fn mk_static_str(self) -> Ty<'tcx>
fn mk_enum(self, def: AdtDef<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx>
fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_ptr(self, tm: TypeAndMut<'tcx>) -> Ty<'tcx>
fn mk_ref(self, r: &'tcx Region, tm: TypeAndMut<'tcx>) -> Ty<'tcx>
fn mk_mut_ref(self, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_imm_ref(self, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_mut_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_imm_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_nil_ptr(self) -> Ty<'tcx>
fn mk_array(self, ty: Ty<'tcx>, n: usize) -> Ty<'tcx>
fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx>
fn mk_tup(self, ts: Vec<Ty<'tcx>>) -> Ty<'tcx>
fn mk_nil(self) -> Ty<'tcx>
fn mk_bool(self) -> Ty<'tcx>
fn mk_fn_def(self, def_id: DefId, substs: &'tcx Substs<'tcx>, fty: &'tcx BareFnTy<'tcx>) -> Ty<'tcx>
fn mk_fn_ptr(self, fty: &'tcx BareFnTy<'tcx>) -> Ty<'tcx>
fn mk_trait(self, principal: PolyTraitRef<'tcx>, bounds: ExistentialBounds<'tcx>) -> Ty<'tcx>
fn mk_projection(self, trait_ref: TraitRef<'tcx>, item_name: Name) -> Ty<'tcx>
fn mk_struct(self, def: AdtDef<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx>
fn mk_closure(self, closure_id: DefId, substs: &'tcx Substs<'tcx>, tys: Vec<Ty<'tcx>>) -> Ty<'tcx>
fn mk_closure_from_closure_substs(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>) -> Ty<'tcx>
fn mk_var(self, v: TyVid) -> Ty<'tcx>
fn mk_int_var(self, v: IntVid) -> Ty<'tcx>
fn mk_float_var(self, v: FloatVid) -> Ty<'tcx>
fn mk_infer(self, it: InferTy) -> Ty<'tcx>
fn mk_param(self, space: ParamSpace, index: u32, name: Name) -> Ty<'tcx>
fn mk_self_type(self) -> Ty<'tcx>
fn mk_param_from_def(self, def: &TypeParameterDef) -> Ty<'tcx>
fn trait_items(self, trait_did: DefId) -> Rc<Vec<ImplOrTraitItem<'gcx>>>
fn lookup_repr_hints(self, did: DefId) -> Rc<Vec<ReprAttr>>
rustc_private
)Obtain the representation annotation for a struct definition.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn try_add_builtin_trait(self, trait_def_id: DefId, builtin_bounds: &mut EnumSet<BuiltinBound>) -> bool
rustc_private
)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.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn node_id_to_type(self, id: NodeId) -> Ty<'gcx>
fn node_id_to_type_opt(self, id: NodeId) -> Option<Ty<'gcx>>
fn node_id_item_substs(self, id: NodeId) -> ItemSubsts<'gcx>
fn pat_ty(self, pat: &Pat) -> Ty<'gcx>
fn pat_ty_opt(self, pat: &Pat) -> Option<Ty<'gcx>>
fn expr_ty(self, expr: &Expr) -> Ty<'gcx>
fn expr_ty_opt(self, expr: &Expr) -> Option<Ty<'gcx>>
fn expr_ty_adjusted(self, expr: &Expr) -> Ty<'gcx>
rustc_private
)Returns the type of expr
, considering any AutoAdjustment
entry recorded for that expression.
It would almost certainly be better to store the adjusted ty in with
the AutoAdjustment
, but I opted not to do this because it would
require serializing and deserializing the type and, although that's not
hard to do, I just hate that code so much I didn't want to touch it
unless it was to fix it properly, which seemed a distraction from the
thread at hand! -nmatsakis
fn expr_ty_adjusted_opt(self, expr: &Expr) -> Option<Ty<'gcx>>
fn expr_span(self, id: NodeId) -> Span
fn local_var_name_str(self, id: NodeId) -> InternedString
fn resolve_expr(self, expr: &Expr) -> Def
fn expr_is_lval(self, expr: &Expr) -> bool
fn provided_trait_methods(self, id: DefId) -> Vec<Rc<Method<'gcx>>>
fn associated_consts(self, id: DefId) -> Vec<Rc<AssociatedConst<'gcx>>>
fn trait_impl_polarity(self, id: DefId) -> Option<ImplPolarity>
fn custom_coerce_unsized_kind(self, did: DefId) -> CustomCoerceUnsized
fn impl_or_trait_item(self, id: DefId) -> ImplOrTraitItem<'gcx>
fn trait_item_def_ids(self, id: DefId) -> Rc<Vec<ImplOrTraitItemId>>
fn impl_trait_ref(self, id: DefId) -> Option<TraitRef<'gcx>>
rustc_private
)Returns the trait-ref corresponding to a given impl, or None if it is an inherent impl.
fn is_impl(self, id: DefId) -> bool
rustc_private
)Returns whether this DefId refers to an impl
fn trait_ref_to_def_id(self, tr: &TraitRef) -> DefId
fn def_key(self, id: DefId) -> DefKey
fn def_path(self, id: DefId) -> DefPath
rustc_private
)Returns the DefPath
of an item. Note that if id
is not
local to this crate -- or is inlined into this crate -- the
result will be a non-local DefPath
.
fn item_name(self, id: DefId) -> Name
fn register_item_type(self, did: DefId, ty: TypeScheme<'gcx>)
fn lookup_item_type(self, did: DefId) -> TypeScheme<'gcx>
fn lookup_trait_def(self, did: DefId) -> &'gcx TraitDef<'gcx>
rustc_private
)Given the did of a trait, returns its canonical trait ref.
fn lookup_adt_def_master(self, did: DefId) -> AdtDefMaster<'gcx>
rustc_private
)Given the did of an ADT, return a master reference to its definition. Unless you are planning on fulfilling the ADT's fields, use lookup_adt_def instead.
fn lookup_adt_def(self, did: DefId) -> AdtDef<'gcx>
rustc_private
)Given the did of an ADT, return a reference to its definition.
fn lookup_predicates(self, did: DefId) -> GenericPredicates<'gcx>
rustc_private
)Given the did of an item, returns its full set of predicates.
fn lookup_super_predicates(self, did: DefId) -> GenericPredicates<'gcx>
rustc_private
)Given the did of a trait, returns its superpredicates.
fn type_needs_drop_given_env(self, ty: Ty<'gcx>, param_env: &ParameterEnvironment<'gcx>) -> bool
rustc_private
)If type_needs_drop
returns true, then ty
is definitely
non-copy and might have a destructor attached; if it returns
false, then ty
definitely has no destructor (i.e. no drop glue).
(Note that this implies that if ty
has a destructor attached,
then type_needs_drop
will definitely return true
for ty
.)
fn get_attrs(self, did: DefId) -> Cow<'gcx, [Attribute]>
rustc_private
)Get the attributes of a definition.
fn has_attr(self, did: DefId, attr: &str) -> bool
rustc_private
)Determine whether an item is annotated with an attribute
fn lookup_packed(self, did: DefId) -> bool
rustc_private
)Determine whether an item is annotated with #[repr(packed)]
fn lookup_simd(self, did: DefId) -> bool
rustc_private
)Determine whether an item is annotated with #[simd]
fn item_variances(self, item_id: DefId) -> Rc<ItemVariances>
fn trait_has_default_impl(self, trait_def_id: DefId) -> bool
fn record_trait_has_default_impl(self, trait_def_id: DefId)
rustc_private
)Records a trait-to-implementation mapping.
fn populate_implementations_for_primitive_if_necessary(self, primitive_def_id: DefId)
rustc_private
)Load primitive inherent implementations if necessary
fn populate_inherent_implementations_for_type_if_necessary(self, type_id: DefId)
rustc_private
)Populates the type context with all the inherent implementations for the given type if necessary.
fn populate_implementations_for_trait_if_necessary(self, trait_id: DefId)
rustc_private
)Populates the type context with all the implementations for the given trait if necessary.
fn closure_kind(self, def_id: DefId) -> ClosureKind
fn closure_type(self, def_id: DefId, substs: ClosureSubsts<'tcx>) -> ClosureTy<'tcx>
fn trait_id_of_impl(self, def_id: DefId) -> Option<DefId>
rustc_private
)Given the def_id of an impl, return the def_id of the trait it implements.
If it implements no trait, return None
.
fn impl_of_method(self, def_id: DefId) -> Option<DefId>
rustc_private
)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
.
fn trait_of_item(self, def_id: DefId) -> Option<DefId>
rustc_private
)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
.
fn trait_item_of_item(self, def_id: DefId) -> Option<ImplOrTraitItemId>
rustc_private
)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
.
fn empty_parameter_environment(self) -> ParameterEnvironment<'tcx>
rustc_private
)Construct a parameter environment suitable for static contexts or other contexts where there are no free type/lifetime parameters in scope.
fn construct_free_substs(self, generics: &Generics<'gcx>, free_id_outlive: CodeExtent) -> Substs<'gcx>
rustc_private
)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.
fn construct_parameter_environment(self, span: Span, generics: &Generics<'gcx>, generic_predicates: &GenericPredicates<'gcx>, free_id_outlive: CodeExtent) -> ParameterEnvironment<'gcx>
rustc_private
)See ParameterEnvironment
struct def'n for details.
If you were using free_id: NodeId
, you might try self.region_maps.item_extent(free_id)
for the free_id_outlive
parameter. (But note that that is not always quite right.)
fn is_method_call(self, expr_id: NodeId) -> bool
fn is_overloaded_autoderef(self, expr_id: NodeId, autoderefs: u32) -> bool
fn upvar_capture(self, upvar_id: UpvarId) -> Option<UpvarCapture>
fn visit_all_items_in_krate<V, F>(self, dep_node_fn: F, visitor: &mut V) where F: FnMut(DefId) -> DepNode<DefId>, V: Visitor<'gcx>
fn span_of_impl(self, impl_did: DefId) -> Result<Span, InternedString>
rustc_private
)Looks up the span of impl_did
if the impl is local; otherwise returns Err
with the name of the crate containing the impl.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
Trait Implementations
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
[src]
type Target = &'a GlobalCtxt<'gcx>
The resulting type after dereferencing
fn deref(&self) -> &Self::Target
The method called to dereference a value
Derived Implementations
impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> Clone for TyCtxt<'a, 'gcx, 'tcx>
[src]
fn clone(&self) -> TyCtxt<'a, 'gcx, 'tcx>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more