Struct rustc::ty::TyCtxt
[−]
[src]
pub struct TyCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /* 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: &'tcx Region,
suffix: &str)
err: &mut DiagnosticBuilder,
prefix: &str,
region: &'tcx Region,
suffix: &str)
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx>
[src]
fn infer_ctxt<E: InferEnv<'a, 'gcx>>(self,
env: E,
projection_mode: Reveal)
-> InferCtxtBuilder<'a, 'gcx, 'tcx>
env: E,
projection_mode: Reveal)
-> InferCtxtBuilder<'a, 'gcx, 'tcx>
rustc_private
)fn borrowck_fake_infer_ctxt(self, body: BodyId) -> 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 erase_late_bound_regions_and_normalize<T>(self, value: &Binder<T>) -> T where T: TransNormalize<'tcx>
rustc_private
)Currently, higher-ranked type bounds inhibit normalization. Therefore, each time we erase them in translation, we need to normalize the contents.
fn normalize_associated_type<T>(self, value: &T) -> T where T: TransNormalize<'tcx>
rustc_private
)fn normalize_associated_type_in_env<T>(self,
value: &T,
env: &'a ParameterEnvironment<'tcx>)
-> T where T: TransNormalize<'tcx>
value: &T,
env: &'a ParameterEnvironment<'tcx>)
-> T where T: TransNormalize<'tcx>
rustc_private
)impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx>
[src]
fn require_lang_item(&self, lang_item: LangItem) -> DefId
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn check_stability(self, def_id: DefId, id: NodeId, span: Span)
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn lookup_stability(self, id: DefId) -> Option<&'gcx Stability>
rustc_private
)Lookup the stability for a node, loading external crate metadata as necessary.
fn lookup_deprecation(self, id: DefId) -> Option<Deprecation>
rustc_private
)fn lookup_deprecation_entry(self, id: DefId) -> Option<DeprecationEntry>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn recursive_type_with_infinite_size_error(self,
type_def_id: DefId)
-> DiagnosticBuilder<'tcx>
type_def_id: DefId)
-> DiagnosticBuilder<'tcx>
rustc_private
)fn report_object_safety_error(self,
span: Span,
trait_def_id: DefId,
violations: Vec<ObjectSafetyViolation>)
-> DiagnosticBuilder<'tcx>
span: Span,
trait_def_id: DefId,
violations: Vec<ObjectSafetyViolation>)
-> DiagnosticBuilder<'tcx>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn is_object_safe(self, trait_def_id: DefId) -> bool
rustc_private
)fn astconv_object_safety_violations(self,
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation>
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation>
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>
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation>
rustc_private
)fn is_vtable_safe_method(self,
trait_def_id: DefId,
method: &AssociatedItem)
-> bool
trait_def_id: DefId,
method: &AssociatedItem)
-> 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 predicate_for_trait_def(self,
cause: ObligationCause<'tcx>,
trait_def_id: DefId,
recursion_depth: usize,
param_ty: Ty<'tcx>,
ty_params: &[Ty<'tcx>])
-> PredicateObligation<'tcx>
cause: ObligationCause<'tcx>,
trait_def_id: DefId,
recursion_depth: usize,
param_ty: Ty<'tcx>,
ty_params: &[Ty<'tcx>])
-> PredicateObligation<'tcx>
rustc_private
)fn upcast_choices(self,
source_trait_ref: PolyTraitRef<'tcx>,
target_trait_def_id: DefId)
-> Vec<PolyTraitRef<'tcx>>
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
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>)>
fn_trait_def_id: DefId,
self_ty: Ty<'tcx>,
sig: PolyFnSig<'tcx>,
tuple_arguments: TupleArgumentsFlag)
-> Binder<(TraitRef<'tcx>, Ty<'tcx>)>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn note_and_explain_type_err(self,
db: &mut DiagnosticBuilder,
err: &TypeError<'tcx>,
sp: Span)
db: &mut DiagnosticBuilder,
err: &TypeError<'tcx>,
sp: Span)
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn collect_regions<T>(self,
value: &T,
region_set: &mut FxHashSet<&'tcx Region>)
-> bool where T: TypeFoldable<'tcx>
value: &T,
region_set: &mut FxHashSet<&'tcx 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(&'tcx Region, u32) -> &'tcx 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, FxHashMap<BoundRegion, &'tcx Region>) where F: FnMut(BoundRegion) -> &'tcx Region, T: TypeFoldable<'tcx>
value: &Binder<T>,
f: F)
-> (T, FxHashMap<BoundRegion, &'tcx Region>) where F: FnMut(BoundRegion) -> &'tcx Region, T: TypeFoldable<'tcx>
rustc_private
)fn liberate_late_bound_regions<T>(self,
all_outlive_scope: CodeExtent,
value: &Binder<T>)
-> T where T: TypeFoldable<'tcx>
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>
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>
rustc_private
)fn collect_constrained_late_bound_regions<T>(&self,
value: &Binder<T>)
-> FxHashSet<BoundRegion> where T: TypeFoldable<'tcx>
value: &Binder<T>)
-> FxHashSet<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>)
-> FxHashSet<BoundRegion> where T: TypeFoldable<'tcx>
value: &Binder<T>)
-> FxHashSet<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 'erased
. 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, unless with_forced_absolute_paths was used.
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
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
rustc_private
)fn parent_def_id(self, def_id: DefId) -> Option<DefId>
rustc_private
)Returns the def-id of def_id
's parent in the def tree. If
this returns None
, then def_id
represents a crate root or
inlined root.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn report_cycle(self, CycleError { span: span, cycle: cycle }: CycleError)
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn outlives_components(&self, ty0: Ty<'tcx>) -> Vec<Component<'tcx>>
rustc_private
)Returns all the things that must outlive 'a
for the condition
ty0: 'a
to hold. Note that ty0
must be a fully resolved type.
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn has_error_field(self, ty: Ty<'tcx>) -> bool
rustc_private
)fn positional_element_ty(self,
ty: Ty<'tcx>,
i: usize,
variant: Option<DefId>)
-> Option<Ty<'tcx>>
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>>
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 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>)
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<&'tcx Region>
erased_self_ty: Ty<'tcx>,
predicates: Vec<Predicate<'tcx>>)
-> Vec<&'tcx 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 type_id_hash(self, ty: Ty<'tcx>) -> 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 calculate_dtor(self,
adt_did: DefId,
validate: &mut FnMut(Self, DefId) -> Result<(), ErrorReported>)
-> Option<Destructor>
adt_did: DefId,
validate: &mut FnMut(Self, DefId) -> Result<(), ErrorReported>)
-> Option<Destructor>
rustc_private
)Calculate the destructor of a given type.
fn closure_base_def_id(&self, def_id: DefId) -> DefId
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn crate_name(self, cnum: CrateNum) -> Symbol
rustc_private
)fn original_crate_name(self, cnum: CrateNum) -> Symbol
rustc_private
)fn crate_disambiguator(self, cnum: CrateNum) -> Symbol
rustc_private
)fn retrace_path(self,
krate: CrateNum,
path_data: &[DisambiguatedDefPathData])
-> Option<DefId>
krate: CrateNum,
path_data: &[DisambiguatedDefPathData])
-> Option<DefId>
rustc_private
)fn alloc_generics(self, generics: Generics) -> &'gcx Generics
rustc_private
)fn alloc_mir(self, mir: Mir<'gcx>) -> &'gcx RefCell<Mir<'gcx>>
rustc_private
)fn alloc_tables(self, tables: TypeckTables<'gcx>) -> &'gcx TypeckTables<'gcx>
rustc_private
)fn alloc_trait_def(self, def: TraitDef) -> &'gcx TraitDef
rustc_private
)fn alloc_adt_def(self,
did: DefId,
kind: AdtKind,
variants: Vec<VariantDef>,
repr: ReprOptions)
-> &'gcx AdtDef
did: DefId,
kind: AdtKind,
variants: Vec<VariantDef>,
repr: ReprOptions)
-> &'gcx AdtDef
rustc_private
)fn intern_stability(self, stab: Stability) -> &'gcx Stability
rustc_private
)fn intern_layout(self, layout: Layout) -> &'gcx Layout
rustc_private
)fn lift<T: ?Sized + Lift<'tcx>>(self, value: &T) -> Option<T::Lifted>
rustc_private
)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,
local_providers: Providers<'tcx>,
extern_providers: Providers<'tcx>,
arenas: &'tcx GlobalArenas<'tcx>,
arena: &'tcx DroplessArena,
resolutions: Resolutions,
named_region_map: NamedRegionMap,
hir: Map<'tcx>,
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
local_providers: Providers<'tcx>,
extern_providers: Providers<'tcx>,
arenas: &'tcx GlobalArenas<'tcx>,
arena: &'tcx DroplessArena,
resolutions: Resolutions,
named_region_map: NamedRegionMap,
hir: Map<'tcx>,
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)
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn mk_region(self, v: Region) -> &'tcx Region
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn _intern_existential_predicates(self,
v: &[ExistentialPredicate<'tcx>])
-> &'tcx Slice<ExistentialPredicate<'tcx>>
v: &[ExistentialPredicate<'tcx>])
-> &'tcx Slice<ExistentialPredicate<'tcx>>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn _intern_type_list(self, v: &[Ty<'tcx>]) -> &'tcx Slice<Ty<'tcx>>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn _intern_substs(self, v: &[Kind<'tcx>]) -> &'tcx Slice<Kind<'tcx>>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn safe_to_unsafe_fn_ty(self, sig: PolyFnSig<'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>
rustc_private
)fn mk_mach_int(self, tm: IntTy) -> Ty<'tcx>
rustc_private
)fn mk_mach_uint(self, tm: UintTy) -> Ty<'tcx>
rustc_private
)fn mk_mach_float(self, tm: FloatTy) -> Ty<'tcx>
rustc_private
)fn mk_str(self) -> Ty<'tcx>
rustc_private
)fn mk_static_str(self) -> Ty<'tcx>
rustc_private
)fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_ptr(self, tm: TypeAndMut<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_ref(self, r: &'tcx Region, tm: TypeAndMut<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_mut_ref(self, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_imm_ref(self, r: &'tcx Region, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_mut_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_imm_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_nil_ptr(self) -> Ty<'tcx>
rustc_private
)fn mk_array(self, ty: Ty<'tcx>, n: usize) -> Ty<'tcx>
rustc_private
)fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx>
rustc_private
)fn intern_tup(self, ts: &[Ty<'tcx>], defaulted: bool) -> Ty<'tcx>
rustc_private
)fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self,
iter: I,
defaulted: bool)
-> I::Output
iter: I,
defaulted: bool)
-> I::Output
rustc_private
)fn mk_nil(self) -> Ty<'tcx>
rustc_private
)fn mk_diverging_default(self) -> Ty<'tcx>
rustc_private
)fn mk_bool(self) -> Ty<'tcx>
rustc_private
)fn mk_fn_def(self,
def_id: DefId,
substs: &'tcx Substs<'tcx>,
fty: PolyFnSig<'tcx>)
-> Ty<'tcx>
def_id: DefId,
substs: &'tcx Substs<'tcx>,
fty: PolyFnSig<'tcx>)
-> Ty<'tcx>
rustc_private
)fn mk_fn_ptr(self, fty: PolyFnSig<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_dynamic(self,
obj: Binder<&'tcx Slice<ExistentialPredicate<'tcx>>>,
reg: &'tcx Region)
-> Ty<'tcx>
obj: Binder<&'tcx Slice<ExistentialPredicate<'tcx>>>,
reg: &'tcx Region)
-> Ty<'tcx>
rustc_private
)fn mk_projection(self, trait_ref: TraitRef<'tcx>, item_name: Name) -> Ty<'tcx>
rustc_private
)fn mk_closure(self, closure_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx>
rustc_private
)fn mk_closure_from_closure_substs(self,
closure_id: DefId,
closure_substs: ClosureSubsts<'tcx>)
-> Ty<'tcx>
closure_id: DefId,
closure_substs: ClosureSubsts<'tcx>)
-> Ty<'tcx>
rustc_private
)fn mk_var(self, v: TyVid) -> Ty<'tcx>
rustc_private
)fn mk_int_var(self, v: IntVid) -> Ty<'tcx>
rustc_private
)fn mk_float_var(self, v: FloatVid) -> Ty<'tcx>
rustc_private
)fn mk_infer(self, it: InferTy) -> Ty<'tcx>
rustc_private
)fn mk_param(self, index: u32, name: Name) -> Ty<'tcx>
rustc_private
)fn mk_self_type(self) -> Ty<'tcx>
rustc_private
)fn mk_param_from_def(self, def: &TypeParameterDef) -> Ty<'tcx>
rustc_private
)fn mk_anon(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx>
rustc_private
)fn intern_existential_predicates(self,
eps: &[ExistentialPredicate<'tcx>])
-> &'tcx Slice<ExistentialPredicate<'tcx>>
eps: &[ExistentialPredicate<'tcx>])
-> &'tcx Slice<ExistentialPredicate<'tcx>>
rustc_private
)fn intern_type_list(self, ts: &[Ty<'tcx>]) -> &'tcx Slice<Ty<'tcx>>
rustc_private
)fn intern_substs(self, ts: &[Kind<'tcx>]) -> &'tcx Slice<Kind<'tcx>>
rustc_private
)fn mk_fn_sig<I>(self,
inputs: I,
output: I::Item,
variadic: bool,
unsafety: Unsafety,
abi: Abi)
-> I::Item::Output where I: Iterator, I::Item: InternIteratorElement<Ty<'tcx>, FnSig<'tcx>>
inputs: I,
output: I::Item,
variadic: bool,
unsafety: Unsafety,
abi: Abi)
-> I::Item::Output where I: Iterator, I::Item: InternIteratorElement<Ty<'tcx>, FnSig<'tcx>>
rustc_private
)fn mk_existential_predicates<I: InternAs<[ExistentialPredicate<'tcx>], &'tcx Slice<ExistentialPredicate<'tcx>>>>(self,
iter: I)
-> I::Output
iter: I)
-> I::Output
rustc_private
)fn mk_type_list<I: InternAs<[Ty<'tcx>], &'tcx Slice<Ty<'tcx>>>>(self,
iter: I)
-> I::Output
iter: I)
-> I::Output
rustc_private
)fn mk_substs<I: InternAs<[Kind<'tcx>], &'tcx Slice<Kind<'tcx>>>>(self,
iter: I)
-> I::Output
iter: I)
-> I::Output
rustc_private
)fn mk_substs_trait(self, s: Ty<'tcx>, t: &[Ty<'tcx>]) -> &'tcx Substs<'tcx>
rustc_private
)impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]
fn body_tables(self, body: BodyId) -> &'gcx TypeckTables<'gcx>
rustc_private
)fn item_tables(self, def_id: DefId) -> &'gcx TypeckTables<'gcx>
rustc_private
)fn expr_span(self, id: NodeId) -> Span
rustc_private
)fn local_var_name_str(self, id: NodeId) -> InternedString
rustc_private
)fn expr_is_lval(self, expr: &Expr) -> bool
rustc_private
)fn provided_trait_methods(self, id: DefId) -> Vec<AssociatedItem>
rustc_private
)fn trait_impl_polarity(self, id: DefId) -> ImplPolarity
rustc_private
)fn trait_relevant_for_never(self, did: DefId) -> bool
rustc_private
)fn custom_coerce_unsized_kind(self, did: DefId) -> CustomCoerceUnsized
rustc_private
)fn associated_item(self, def_id: DefId) -> AssociatedItem
rustc_private
)fn associated_item_def_ids(self, def_id: DefId) -> Rc<Vec<DefId>>
rustc_private
)fn associated_items(self,
def_id: DefId)
-> impl Iterator<Item=AssociatedItem> + 'a
def_id: DefId)
-> impl Iterator<Item=AssociatedItem> + 'a
rustc_private
)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 expect_variant_def(self, def: Def) -> &'tcx VariantDef
rustc_private
)fn def_key(self, id: DefId) -> DefKey
rustc_private
)fn def_path(self, id: DefId) -> DefPath
rustc_private
)Convert a DefId
into its fully expanded DefPath
(every
DefId
is really just an interned def-path).
Note that if id
is not local to this crate, the result will
fn def_span(self, def_id: DefId) -> Span
rustc_private
)fn vis_is_accessible_from(self, vis: Visibility, block: NodeId) -> bool
rustc_private
)fn item_name(self, id: DefId) -> Name
rustc_private
)fn item_type(self, did: DefId) -> Ty<'gcx>
rustc_private
)fn lookup_trait_def(self, did: DefId) -> &'gcx TraitDef
rustc_private
)Given the did of a trait, returns its canonical trait ref.
fn lookup_adt_def(self, did: DefId) -> &'gcx AdtDef
rustc_private
)Given the did of an ADT, return a reference to its definition.
fn item_generics(self, did: DefId) -> &'gcx Generics
rustc_private
)Given the did of an item, returns its generics.
fn item_predicates(self, did: DefId) -> GenericPredicates<'gcx>
rustc_private
)Given the did of an item, returns its full set of predicates.
fn item_super_predicates(self, did: DefId) -> GenericPredicates<'gcx>
rustc_private
)Given the did of a trait, returns its superpredicates.
fn item_mir(self, did: DefId) -> Ref<'gcx, Mir<'gcx>>
rustc_private
)Given the did of an item, returns its MIR, borrowed immutably.
fn maybe_item_mir(self, did: DefId) -> Option<Ref<'gcx, Mir<'gcx>>>
rustc_private
)Given the DefId of an item, returns its MIR, borrowed immutably. Returns None if there is no MIR for the DefId
fn type_needs_drop_given_env(self,
ty: Ty<'gcx>,
param_env: &ParameterEnvironment<'gcx>)
-> bool
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 item_variances(self, item_id: DefId) -> Rc<Vec<Variance>>
rustc_private
)fn trait_has_default_impl(self, trait_def_id: DefId) -> bool
rustc_private
)fn populate_inherent_implementations_for_type_if_necessary(self,
span: Span,
type_id: DefId)
span: Span,
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
rustc_private
)fn closure_type(self, def_id: DefId) -> PolyFnSig<'tcx>
rustc_private
)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,
return the ID of the trait that the trait item belongs to.
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,
def_id: DefId,
free_id_outlive: CodeExtent)
-> &'gcx Substs<'gcx>
def_id: DefId,
free_id_outlive: CodeExtent)
-> &'gcx 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,
def_id: DefId,
free_id_outlive: CodeExtent)
-> ParameterEnvironment<'gcx>
span: Span,
def_id: DefId,
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 this is not always quite right.)
fn node_scope_region(self, id: NodeId) -> &'tcx Region
rustc_private
)fn visit_all_item_likes_in_krate<V, F>(self, dep_node_fn: F, visitor: &mut V) where F: FnMut(DefId) -> DepNode<DefId>, V: ItemLikeVisitor<'gcx>
rustc_private
)fn visit_all_bodies_in_krate<C>(self, callback: C) where C: Fn(DefId, BodyId)
rustc_private
)Invokes callback
for each body in the krate. This will
create a read edge from DepNode::Krate
to the current task;
it is meant to be run in the context of some global task like
BorrowckCrate
. The callback would then create a task like
BorrowckBody(DefId)
to process each individual item.
fn span_of_impl(self, impl_did: DefId) -> Result<Span, Symbol>
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]
fn with_freevars<T, F>(self, fid: NodeId, f: F) -> T where F: FnOnce(&[Freevar]) -> T
rustc_private
)Trait Implementations
impl<'a, 'gcx, 'tcx> DepGraphSafe for TyCtxt<'a, 'gcx, 'tcx>
[src]
The type context itself can be used to access all kinds of tracked state, but those accesses should always generate read events.
impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> Copy for TyCtxt<'a, 'gcx, 'tcx>
[src]
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
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