Struct rustc::ty::TyCtxt [] [src]

pub struct TyCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

Currently, higher-ranked type bounds inhibit normalization. Therefore, each time we erase them in translation, we need to normalize the contents.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

Lookup the stability for a node, loading external crate metadata as necessary.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

Collects the free and escaping regions in value into region_set. Returns whether any late-bound regions were skipped

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

Flattens two binding levels into one. So for<'a> for<'b> Foo becomes for<'a,'b> Foo.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

Returns a set of all late-bound regions that appear in value anywhere.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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 FnSigs or TraitRefs 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]

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

Returns a string identifying this local node-id.

🔬 This is a nightly-only experimental API. (rustc_private)

Returns a string identifying this def-id. This string is suitable for user output. It always begins with a crate identifier.

🔬 This is a nightly-only experimental API. (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.)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

Calculate the destructor of a given type.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

Given the def-id of some item that has no type parameters, make a suitable "empty substs" for it.

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

Like lift, but only tries in the global tcx.

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

Create an unsafe fn ty based on a safe fn ty.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

Returns the trait-ref corresponding to a given impl, or None if it is an inherent impl.

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

Given the did of an ADT, return a reference to its definition.

🔬 This is a nightly-only experimental API. (rustc_private)

Given the did of an item, returns its generics.

🔬 This is a nightly-only experimental API. (rustc_private)

Given the did of an item, returns its full set of predicates.

🔬 This is a nightly-only experimental API. (rustc_private)

Given the did of a trait, returns its superpredicates.

🔬 This is a nightly-only experimental API. (rustc_private)

Given the did of an item, returns its MIR, borrowed immutably.

🔬 This is a nightly-only experimental API. (rustc_private)

Return the possibly-auto-generated MIR of a (DefId, Subst) pair.

🔬 This is a nightly-only experimental API. (rustc_private)

Given the DefId of an item, returns its MIR, borrowed immutably. Returns None if there is no MIR for the DefId

🔬 This is a nightly-only experimental API. (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.)

🔬 This is a nightly-only experimental API. (rustc_private)

Get the attributes of a definition.

🔬 This is a nightly-only experimental API. (rustc_private)

Determine whether an item is annotated with an attribute

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (rustc_private)

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

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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.)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (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.

🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (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]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<'a, 'gcx, 'tcx> DefIdTree for TyCtxt<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)