Struct rustc_middle::ty::query::TyCtxtEnsure
source · pub struct TyCtxtEnsure<'tcx> {
pub tcx: TyCtxt<'tcx>,
}
Fields§
§tcx: TyCtxt<'tcx>
Implementations§
source§impl<'tcx> TyCtxtEnsure<'tcx>
impl<'tcx> TyCtxtEnsure<'tcx>
sourcepub fn const_eval_poly(self, def_id: DefId)
pub fn const_eval_poly(self, def_id: DefId)
Evaluates a constant without providing any substitutions. This is useful to evaluate consts
that can’t take any generic arguments like statics, const items or enum discriminants. If a
generic parameter is used within the constant ErrorHandled::ToGeneric
will be returned.
sourcepub fn eval_static_initializer(self, def_id: DefId)
pub fn eval_static_initializer(self, def_id: DefId)
Evaluate a static’s initializer, returning the allocation of the initializer’s memory.
source§impl<'tcx> TyCtxtEnsure<'tcx>
impl<'tcx> TyCtxtEnsure<'tcx>
sourcepub fn trigger_delay_span_bug(self, key: impl IntoQueryParam<DefId>)
pub fn trigger_delay_span_bug(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] triggering a delay span bug
sourcepub fn resolutions(self, key: ())
pub fn resolutions(self, key: ())
[query description - consider adding a doc-comment!] getting the resolver outputs
sourcepub fn resolver_for_lowering(self, key: ())
pub fn resolver_for_lowering(self, key: ())
[query description - consider adding a doc-comment!] getting the resolver for lowering
sourcepub fn source_span(self, key: LocalDefId)
pub fn source_span(self, key: LocalDefId)
Return the span for a definition.
Contrary to def_span
below, this query returns the full absolute span of the definition.
This span is meant for dep-tracking rather than diagnostics. It should not be used outside
of rustc_middle::hir::source_map.
sourcepub fn hir_crate(self, key: ())
pub fn hir_crate(self, key: ())
Represents crate as a whole (as distinct from the top-level crate module).
If you call hir_crate
(e.g., indirectly by calling tcx.hir().krate()
),
we will have to assume that any change means that you need to be recompiled.
This is because the hir_crate
query gives you access to all other items.
To avoid this fate, do not call tcx.hir().krate()
; instead,
prefer wrappers like tcx.visit_all_items_in_krate()
.
sourcepub fn hir_crate_items(self, key: ())
pub fn hir_crate_items(self, key: ())
All items in the crate.
sourcepub fn hir_module_items(self, key: LocalDefId)
pub fn hir_module_items(self, key: LocalDefId)
The items in a module.
This can be conveniently accessed by tcx.hir().visit_item_likes_in_module
.
Avoid calling this query directly.
sourcepub fn hir_owner(self, key: OwnerId)
pub fn hir_owner(self, key: OwnerId)
Gives access to the HIR node for the HIR owner key
.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
sourcepub fn local_def_id_to_hir_id(self, key: LocalDefId)
pub fn local_def_id_to_hir_id(self, key: LocalDefId)
Gives access to the HIR ID for the given LocalDefId
owner key
.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
sourcepub fn hir_owner_parent(self, key: OwnerId)
pub fn hir_owner_parent(self, key: OwnerId)
Gives access to the HIR node’s parent for the HIR owner key
.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
sourcepub fn hir_owner_nodes(self, key: OwnerId)
pub fn hir_owner_nodes(self, key: OwnerId)
Gives access to the HIR nodes and bodies inside the HIR owner key
.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
sourcepub fn hir_attrs(self, key: OwnerId)
pub fn hir_attrs(self, key: OwnerId)
Gives access to the HIR attributes inside the HIR owner key
.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
sourcepub fn opt_const_param_of(self, key: LocalDefId)
pub fn opt_const_param_of(self, key: LocalDefId)
Computes the DefId
of the corresponding const parameter in case the key
is a
const argument and returns None
otherwise.
let a = foo::<7>();
// ^ Calling `opt_const_param_of` for this argument,
fn foo<const N: usize>()
// ^ returns this `DefId`.
fn bar() {
// ^ While calling `opt_const_param_of` for other bodies returns `None`.
}
sourcepub fn const_param_default(self, key: impl IntoQueryParam<DefId>)
pub fn const_param_default(self, key: impl IntoQueryParam<DefId>)
Given the def_id of a const-generic parameter, computes the associated default const
parameter. e.g. fn example<const N: usize=3>
called on N
would return 3
.
sourcepub fn type_of(self, key: impl IntoQueryParam<DefId>)
pub fn type_of(self, key: impl IntoQueryParam<DefId>)
sourcepub fn collect_trait_impl_trait_tys(self, key: impl IntoQueryParam<DefId>)
pub fn collect_trait_impl_trait_tys(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] comparing an impl and trait method signature, inferring any hidden impl Trait
types in the process
sourcepub fn analysis(self, key: ())
pub fn analysis(self, key: ())
[query description - consider adding a doc-comment!] running analysis passes on this crate
sourcepub fn check_expectations(self, key: Option<Symbol>)
pub fn check_expectations(self, key: Option<Symbol>)
This query checks the fulfillment of collected lint expectations. All lint emitting queries have to be done before this is executed to ensure that all expectations can be fulfilled.
This is an extra query to enable other drivers (like rustdoc) to
only execute a small subset of the analysis
query, while allowing
lints to be expected. In rustc, this query will be executed as part of
the analysis
query and doesn’t have to be called a second time.
Tools can additionally pass in a tool filter. That will restrict the
expectations to only trigger for lints starting with the listed tool
name. This is useful for cases were not all linting code from rustc
was called. With the default None
all registered lints will also
be checked for expectation fulfillment.
sourcepub fn generics_of(self, key: impl IntoQueryParam<DefId>)
pub fn generics_of(self, key: impl IntoQueryParam<DefId>)
Maps from the DefId
of an item (trait/struct/enum/fn) to its
associated generics.
sourcepub fn predicates_of(self, key: impl IntoQueryParam<DefId>)
pub fn predicates_of(self, key: impl IntoQueryParam<DefId>)
Maps from the DefId
of an item (trait/struct/enum/fn) to the
predicates (where-clauses) that must be proven true in order
to reference it. This is almost always the “predicates query”
that you want.
predicates_of
builds on predicates_defined_on
– in fact,
it is almost always the same as that query, except for the
case of traits. For traits, predicates_of
contains
an additional Self: Trait<...>
predicate that users don’t
actually write. This reflects the fact that to invoke the
trait (e.g., via Default::default
) you must supply types
that actually implement the trait. (However, this extra
predicate gets in the way of some checks, which are intended
to operate over only the actual where-clauses written by the
user.)
sourcepub fn explicit_item_bounds(self, key: impl IntoQueryParam<DefId>)
pub fn explicit_item_bounds(self, key: impl IntoQueryParam<DefId>)
Returns the list of bounds that can be used for
SelectionCandidate::ProjectionCandidate(_)
and
ProjectionTyCandidate::TraitDef
.
Specifically this is the bounds written on the trait’s type
definition, or those after the impl
keyword
type X: Bound + 'lt
// ^^^^^^^^^^^
impl Debug + Display
// ^^^^^^^^^^^^^^^
key
is the DefId
of the associated type or opaque type.
Bounds from the parent (e.g. with nested impl trait) are not included.
sourcepub fn item_bounds(self, key: impl IntoQueryParam<DefId>)
pub fn item_bounds(self, key: impl IntoQueryParam<DefId>)
Elaborated version of the predicates from explicit_item_bounds
.
For example:
trait MyTrait {
type MyAType: Eq + ?Sized;
}
explicit_item_bounds
returns [<Self as MyTrait>::MyAType: Eq]
,
and item_bounds
returns
[
<Self as Trait>::MyAType: Eq,
<Self as Trait>::MyAType: PartialEq<<Self as Trait>::MyAType>
]
Bounds from the parent (e.g. with nested impl trait) are not included.
sourcepub fn native_libraries(self, key: CrateNum)
pub fn native_libraries(self, key: CrateNum)
Look up all native libraries this crate depends on. These are assembled from the following places:
extern
blocks (depending on theirlink
attributes)- the
libs
(-l
) option
sourcepub fn shallow_lint_levels_on(self, key: OwnerId)
pub fn shallow_lint_levels_on(self, key: OwnerId)
[query description - consider adding a doc-comment!] looking up lint levels for tcx.def_path_str(key.to_def_id())
sourcepub fn lint_expectations(self, key: ())
pub fn lint_expectations(self, key: ())
[query description - consider adding a doc-comment!] computing #[expect]
ed lints in this crate
sourcepub fn parent_module_from_def_id(self, key: LocalDefId)
pub fn parent_module_from_def_id(self, key: LocalDefId)
[query description - consider adding a doc-comment!] getting the parent module of tcx.def_path_str(key.to_def_id())
sourcepub fn expn_that_defined(self, key: impl IntoQueryParam<DefId>)
pub fn expn_that_defined(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] getting the expansion that defined tcx.def_path_str(key)
sourcepub fn is_panic_runtime(self, key: CrateNum)
pub fn is_panic_runtime(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if the crate is_panic_runtime
sourcepub fn representability(self, key: LocalDefId)
pub fn representability(self, key: LocalDefId)
Checks whether a type is representable or infinitely sized
sourcepub fn representability_adt_ty(self, key: Ty<'tcx>)
pub fn representability_adt_ty(self, key: Ty<'tcx>)
An implementation detail for the representability
query
sourcepub fn params_in_repr(self, key: impl IntoQueryParam<DefId>)
pub fn params_in_repr(self, key: impl IntoQueryParam<DefId>)
Set of param indexes for type params that are in the type’s representation
sourcepub fn thir_body(self, key: WithOptConstParam<LocalDefId>)
pub fn thir_body(self, key: WithOptConstParam<LocalDefId>)
Fetch the THIR for a given body. If typeck for that body failed, returns an empty Thir
.
sourcepub fn thir_tree(self, key: WithOptConstParam<LocalDefId>)
pub fn thir_tree(self, key: WithOptConstParam<LocalDefId>)
Create a THIR tree for debugging.
sourcepub fn mir_keys(self, key: ())
pub fn mir_keys(self, key: ())
Set of all the DefId
s in this crate that have MIR associated with
them. This includes all the body owners, but also things like struct
constructors.
sourcepub fn mir_const_qualif(self, key: impl IntoQueryParam<DefId>)
pub fn mir_const_qualif(self, key: impl IntoQueryParam<DefId>)
Maps DefId’s that have an associated mir::Body
to the result
of the MIR const-checking pass. This is the set of qualifs in
the final value of a const
.
sourcepub fn mir_const_qualif_const_arg(self, key: (LocalDefId, DefId))
pub fn mir_const_qualif_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] const checking the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn mir_built(self, key: WithOptConstParam<LocalDefId>)
pub fn mir_built(self, key: WithOptConstParam<LocalDefId>)
Fetch the MIR for a given DefId
right after it’s built - this includes
unreachable code.
sourcepub fn mir_const(self, key: WithOptConstParam<LocalDefId>)
pub fn mir_const(self, key: WithOptConstParam<LocalDefId>)
Fetch the MIR for a given DefId
up till the point where it is
ready for const qualification.
See the README for the mir
module for details.
sourcepub fn thir_abstract_const(self, key: impl IntoQueryParam<DefId>)
pub fn thir_abstract_const(self, key: impl IntoQueryParam<DefId>)
Try to build an abstract representation of the given constant.
sourcepub fn thir_abstract_const_of_const_arg(self, key: (LocalDefId, DefId))
pub fn thir_abstract_const_of_const_arg(self, key: (LocalDefId, DefId))
Try to build an abstract representation of the given constant.
sourcepub fn mir_drops_elaborated_and_const_checked(
self,
key: WithOptConstParam<LocalDefId>
)
pub fn mir_drops_elaborated_and_const_checked(
self,
key: WithOptConstParam<LocalDefId>
)
[query description - consider adding a doc-comment!] elaborating drops for tcx.def_path_str(key.did.to_def_id())
sourcepub fn mir_for_ctfe(self, key: impl IntoQueryParam<DefId>)
pub fn mir_for_ctfe(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] caching mir of tcx.def_path_str(key)
for CTFE
sourcepub fn mir_for_ctfe_of_const_arg(self, key: (LocalDefId, DefId))
pub fn mir_for_ctfe_of_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] caching MIR for CTFE of the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn mir_promoted(self, key: WithOptConstParam<LocalDefId>)
pub fn mir_promoted(self, key: WithOptConstParam<LocalDefId>)
[query description - consider adding a doc-comment!] processing MIR for if key.const_param_did.is_some() { "the const argument " } else { "" }
tcx.def_path_str(key.did.to_def_id())
sourcepub fn symbols_for_closure_captures(self, key: (LocalDefId, LocalDefId))
pub fn symbols_for_closure_captures(self, key: (LocalDefId, LocalDefId))
[query description - consider adding a doc-comment!] finding symbols for captures of closure tcx.def_path_str(key.1.to_def_id())
in tcx.def_path_str(key.0.to_def_id())
sourcepub fn optimized_mir(self, key: impl IntoQueryParam<DefId>)
pub fn optimized_mir(self, key: impl IntoQueryParam<DefId>)
MIR after our optimization passes have run. This is MIR that is ready for codegen. This is also the only query that can fetch non-local MIR, at present.
sourcepub fn coverageinfo(self, key: InstanceDef<'tcx>)
pub fn coverageinfo(self, key: InstanceDef<'tcx>)
Returns coverage summary info for a function, after executing the InstrumentCoverage
MIR pass (assuming the -Cinstrument-coverage option is enabled).
sourcepub fn covered_code_regions(self, key: impl IntoQueryParam<DefId>)
pub fn covered_code_regions(self, key: impl IntoQueryParam<DefId>)
Returns the CodeRegions
for a function that has instrumented coverage, in case the
function was optimized out before codegen, and before being added to the Coverage Map.
sourcepub fn promoted_mir(self, key: impl IntoQueryParam<DefId>)
pub fn promoted_mir(self, key: impl IntoQueryParam<DefId>)
The DefId
is the DefId
of the containing MIR body. Promoteds do not have their own
DefId
. This function returns all promoteds in the specified body. The body references
promoteds by the DefId
and the mir::Promoted
index. This is necessary, because
after inlining a body may refer to promoteds from other bodies. In that case you still
need to use the DefId
of the original body.
sourcepub fn promoted_mir_of_const_arg(self, key: (LocalDefId, DefId))
pub fn promoted_mir_of_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] optimizing promoted MIR for the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn erase_regions_ty(self, key: Ty<'tcx>)
pub fn erase_regions_ty(self, key: Ty<'tcx>)
Erases regions from ty
to yield a new type.
Normally you would just use tcx.erase_regions(value)
,
however, which uses this query as a kind of cache.
sourcepub fn wasm_import_module_map(self, key: CrateNum)
pub fn wasm_import_module_map(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting wasm import module map
sourcepub fn predicates_defined_on(self, key: impl IntoQueryParam<DefId>)
pub fn predicates_defined_on(self, key: impl IntoQueryParam<DefId>)
Maps from the DefId
of an item (trait/struct/enum/fn) to the
predicates (where-clauses) directly defined on it. This is
equal to the explicit_predicates_of
predicates plus the
inferred_outlives_of
predicates.
sourcepub fn trait_explicit_predicates_and_bounds(self, key: LocalDefId)
pub fn trait_explicit_predicates_and_bounds(self, key: LocalDefId)
Returns everything that looks like a predicate written explicitly by the user on a trait item.
Traits are unusual, because predicates on associated types are converted into bounds on that type for backwards compatibility:
trait X where Self::U: Copy { type U; }
becomes
trait X { type U: Copy; }
explicit_predicates_of
and explicit_item_bounds
will then take
the appropriate subsets of the predicates here.
sourcepub fn explicit_predicates_of(self, key: impl IntoQueryParam<DefId>)
pub fn explicit_predicates_of(self, key: impl IntoQueryParam<DefId>)
Returns the predicates written explicitly by the user.
sourcepub fn inferred_outlives_of(self, key: impl IntoQueryParam<DefId>)
pub fn inferred_outlives_of(self, key: impl IntoQueryParam<DefId>)
Returns the inferred outlives predicates (e.g., for struct Foo<'a, T> { x: &'a T }
, this would return T: 'a
).
sourcepub fn super_predicates_of(self, key: impl IntoQueryParam<DefId>)
pub fn super_predicates_of(self, key: impl IntoQueryParam<DefId>)
Maps from the DefId
of a trait to the list of
super-predicates. This is a subset of the full list of
predicates. We store these in a separate map because we must
evaluate them even during type conversion, often before the
full predicates are available (note that supertraits have
additional acyclicity requirements).
sourcepub fn super_predicates_that_define_assoc_type(self, key: (DefId, Option<Ident>))
pub fn super_predicates_that_define_assoc_type(self, key: (DefId, Option<Ident>))
The Option<Ident>
is the name of an associated type. If it is None
, then this query
returns the full set of predicates. If Some<Ident>
, then the query returns only the
subset of super-predicates that reference traits that define the given associated type.
This is used to avoid cycles in resolving types like T::Item
.
sourcepub fn type_param_predicates(self, key: (DefId, LocalDefId, Ident))
pub fn type_param_predicates(self, key: (DefId, LocalDefId, Ident))
To avoid cycles within the predicates of a single item we compute
per-type-parameter predicates for resolving T::AssocTy
.
sourcepub fn trait_def(self, key: impl IntoQueryParam<DefId>)
pub fn trait_def(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing trait definition for tcx.def_path_str(key)
sourcepub fn adt_def(self, key: impl IntoQueryParam<DefId>)
pub fn adt_def(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing ADT definition for tcx.def_path_str(key)
sourcepub fn adt_destructor(self, key: impl IntoQueryParam<DefId>)
pub fn adt_destructor(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing Drop
impl for tcx.def_path_str(key)
sourcepub fn adt_sized_constraint(self, key: impl IntoQueryParam<DefId>)
pub fn adt_sized_constraint(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing Sized
constraints for tcx.def_path_str(key)
sourcepub fn adt_dtorck_constraint(self, key: impl IntoQueryParam<DefId>)
pub fn adt_dtorck_constraint(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing drop-check constraints for tcx.def_path_str(key)
sourcepub fn constness(self, key: impl IntoQueryParam<DefId>)
pub fn constness(self, key: impl IntoQueryParam<DefId>)
Returns true
if this is a const fn, use the is_const_fn
to know whether your crate
actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might
not have the feature gate active).
Do not call this function manually. It is only meant to cache the base data for the
is_const_fn
function. Consider using is_const_fn
or is_const_fn_raw
instead.
sourcepub fn asyncness(self, key: impl IntoQueryParam<DefId>)
pub fn asyncness(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking if the function is async: tcx.def_path_str(key)
sourcepub fn is_promotable_const_fn(self, key: impl IntoQueryParam<DefId>)
pub fn is_promotable_const_fn(self, key: impl IntoQueryParam<DefId>)
Returns true
if calls to the function may be promoted.
This is either because the function is e.g., a tuple-struct or tuple-variant
constructor, or because it has the #[rustc_promotable]
attribute. The attribute should
be removed in the future in favour of some form of check which figures out whether the
function does not inspect the bits of any of its arguments (so is essentially just a
constructor function).
sourcepub fn is_foreign_item(self, key: impl IntoQueryParam<DefId>)
pub fn is_foreign_item(self, key: impl IntoQueryParam<DefId>)
Returns true
if this is a foreign item (i.e., linked via extern { ... }
).
sourcepub fn generator_kind(self, key: impl IntoQueryParam<DefId>)
pub fn generator_kind(self, key: impl IntoQueryParam<DefId>)
Returns Some(generator_kind)
if the node pointed to by def_id
is a generator.
sourcepub fn crate_variances(self, key: ())
pub fn crate_variances(self, key: ())
Gets a map with the variance of every item; use item_variance
instead.
sourcepub fn variances_of(self, key: impl IntoQueryParam<DefId>)
pub fn variances_of(self, key: impl IntoQueryParam<DefId>)
Maps from the DefId
of a type or region parameter to its (inferred) variance.
sourcepub fn inferred_outlives_crate(self, key: ())
pub fn inferred_outlives_crate(self, key: ())
Maps from thee DefId
of a type to its (inferred) outlives.
sourcepub fn associated_item_def_ids(self, key: impl IntoQueryParam<DefId>)
pub fn associated_item_def_ids(self, key: impl IntoQueryParam<DefId>)
Maps from an impl/trait DefId
to a list of the DefId
s of its items.
sourcepub fn associated_item(self, key: impl IntoQueryParam<DefId>)
pub fn associated_item(self, key: impl IntoQueryParam<DefId>)
Maps from a trait item to the trait item “descriptor”.
sourcepub fn associated_items(self, key: impl IntoQueryParam<DefId>)
pub fn associated_items(self, key: impl IntoQueryParam<DefId>)
Collects the associated items defined on a trait or impl.
sourcepub fn impl_item_implementor_ids(self, key: impl IntoQueryParam<DefId>)
pub fn impl_item_implementor_ids(self, key: impl IntoQueryParam<DefId>)
Maps from associated items on a trait to the corresponding associated
item on the impl specified by impl_id
.
For example, with the following code
struct Type {}
// DefId
trait Trait { // trait_id
fn f(); // trait_f
fn g() {} // trait_g
}
impl Trait for Type { // impl_id
fn f() {} // impl_f
fn g() {} // impl_g
}
The map returned for tcx.impl_item_implementor_ids(impl_id)
would be
{ trait_f: impl_f, trait_g: impl_g }
sourcepub fn impl_trait_ref(self, key: impl IntoQueryParam<DefId>)
pub fn impl_trait_ref(self, key: impl IntoQueryParam<DefId>)
Given an impl_id
, return the trait it implements.
Return None
if this is an inherent impl.
sourcepub fn impl_polarity(self, key: impl IntoQueryParam<DefId>)
pub fn impl_polarity(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing implementation polarity of tcx.def_path_str(impl_id)
sourcepub fn issue33140_self_ty(self, key: impl IntoQueryParam<DefId>)
pub fn issue33140_self_ty(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing Self type wrt issue #33140 tcx.def_path_str(key)
sourcepub fn inherent_impls(self, key: impl IntoQueryParam<DefId>)
pub fn inherent_impls(self, key: impl IntoQueryParam<DefId>)
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.
sourcepub fn incoherent_impls(self, key: SimplifiedType)
pub fn incoherent_impls(self, key: SimplifiedType)
[query description - consider adding a doc-comment!] collecting all inherent impls for {:?}
sourcepub fn unsafety_check_result(self, key: LocalDefId)
pub fn unsafety_check_result(self, key: LocalDefId)
The result of unsafety-checking this LocalDefId
.
sourcepub fn unsafety_check_result_for_const_arg(self, key: (LocalDefId, DefId))
pub fn unsafety_check_result_for_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] unsafety-checking the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn thir_check_unsafety(self, key: LocalDefId)
pub fn thir_check_unsafety(self, key: LocalDefId)
Unsafety-check this LocalDefId
with THIR unsafeck. This should be
used with -Zthir-unsafeck
.
sourcepub fn thir_check_unsafety_for_const_arg(self, key: (LocalDefId, DefId))
pub fn thir_check_unsafety_for_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] unsafety-checking the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn unsafe_derive_on_repr_packed(self, key: LocalDefId)
pub fn unsafe_derive_on_repr_packed(self, key: LocalDefId)
HACK: when evaluated, this reports an “unsafe derive on repr(packed)” error.
Unsafety checking is executed for each method separately, but we only want to emit this error once per derive. As there are some impls with multiple methods, we use a query for deduplication.
sourcepub fn assumed_wf_types(self, key: impl IntoQueryParam<DefId>)
pub fn assumed_wf_types(self, key: impl IntoQueryParam<DefId>)
Returns the types assumed to be well formed while “inside” of the given item.
Note that we’ve liberated the late bound regions of function signatures, so this can not be used to check whether these types are well formed.
sourcepub fn fn_sig(self, key: impl IntoQueryParam<DefId>)
pub fn fn_sig(self, key: impl IntoQueryParam<DefId>)
Computes the signature of the function.
sourcepub fn lint_mod(self, key: LocalDefId)
pub fn lint_mod(self, key: LocalDefId)
Performs lint checking for the module.
sourcepub fn check_mod_attrs(self, key: LocalDefId)
pub fn check_mod_attrs(self, key: LocalDefId)
Checks the attributes in the module.
sourcepub fn check_mod_unstable_api_usage(self, key: LocalDefId)
pub fn check_mod_unstable_api_usage(self, key: LocalDefId)
Checks for uses of unstable APIs in the module.
sourcepub fn check_mod_const_bodies(self, key: LocalDefId)
pub fn check_mod_const_bodies(self, key: LocalDefId)
Checks the const bodies in the module for illegal operations (e.g. if
or loop
).
sourcepub fn check_mod_loops(self, key: LocalDefId)
pub fn check_mod_loops(self, key: LocalDefId)
Checks the loops in the module.
sourcepub fn check_mod_naked_functions(self, key: LocalDefId)
pub fn check_mod_naked_functions(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking naked functions in describe_as_module(key, tcx)
sourcepub fn check_mod_item_types(self, key: LocalDefId)
pub fn check_mod_item_types(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking item types in describe_as_module(key, tcx)
sourcepub fn check_mod_privacy(self, key: LocalDefId)
pub fn check_mod_privacy(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking privacy in describe_as_module(key, tcx)
sourcepub fn check_liveness(self, key: impl IntoQueryParam<DefId>)
pub fn check_liveness(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking liveness of variables in tcx.def_path_str(key)
sourcepub fn live_symbols_and_ignored_derived_traits(self, key: ())
pub fn live_symbols_and_ignored_derived_traits(self, key: ())
Return the live symbols in the crate for dead code check.
The second return value maps from ADTs to ignored derived traits (e.g. Debug and Clone) and their respective impl (i.e., part of the derive macro)
sourcepub fn check_mod_deathness(self, key: LocalDefId)
pub fn check_mod_deathness(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking deathness of variables in describe_as_module(key, tcx)
sourcepub fn check_mod_impl_wf(self, key: LocalDefId)
pub fn check_mod_impl_wf(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking that impls are well-formed in describe_as_module(key, tcx)
sourcepub fn check_mod_type_wf(self, key: LocalDefId)
pub fn check_mod_type_wf(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking that types are well-formed in describe_as_module(key, tcx)
sourcepub fn collect_mod_item_types(self, key: LocalDefId)
pub fn collect_mod_item_types(self, key: LocalDefId)
[query description - consider adding a doc-comment!] collecting item types in describe_as_module(key, tcx)
sourcepub fn coerce_unsized_info(self, key: impl IntoQueryParam<DefId>)
pub fn coerce_unsized_info(self, key: impl IntoQueryParam<DefId>)
Caches CoerceUnsized
kinds for impls on custom types.
sourcepub fn typeck_item_bodies(self, key: ())
pub fn typeck_item_bodies(self, key: ())
[query description - consider adding a doc-comment!] type-checking all item bodies
sourcepub fn typeck(self, key: LocalDefId)
pub fn typeck(self, key: LocalDefId)
[query description - consider adding a doc-comment!] type-checking tcx.def_path_str(key.to_def_id())
sourcepub fn typeck_const_arg(self, key: (LocalDefId, DefId))
pub fn typeck_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] type-checking the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn diagnostic_only_typeck(self, key: LocalDefId)
pub fn diagnostic_only_typeck(self, key: LocalDefId)
[query description - consider adding a doc-comment!] type-checking tcx.def_path_str(key.to_def_id())
sourcepub fn used_trait_imports(self, key: LocalDefId)
pub fn used_trait_imports(self, key: LocalDefId)
[query description - consider adding a doc-comment!] finding used_trait_imports tcx.def_path_str(key.to_def_id())
sourcepub fn has_typeck_results(self, key: impl IntoQueryParam<DefId>)
pub fn has_typeck_results(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking whether tcx.def_path_str(def_id)
has a body
sourcepub fn coherent_trait(self, key: impl IntoQueryParam<DefId>)
pub fn coherent_trait(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] coherence checking all impls of trait tcx.def_path_str(def_id)
sourcepub fn mir_borrowck(self, key: LocalDefId)
pub fn mir_borrowck(self, key: LocalDefId)
Borrow-checks the function body. If this is a closure, returns additional requirements that the closure’s creator must verify.
sourcepub fn mir_borrowck_const_arg(self, key: (LocalDefId, DefId))
pub fn mir_borrowck_const_arg(self, key: (LocalDefId, DefId))
[query description - consider adding a doc-comment!] borrow-checking the const argument tcx.def_path_str(key.0.to_def_id())
sourcepub fn crate_inherent_impls(self, key: ())
pub fn crate_inherent_impls(self, key: ())
Gets a complete map from all types to their inherent impls. Not meant to be used directly outside of coherence.
sourcepub fn crate_inherent_impls_overlap_check(self, key: ())
pub fn crate_inherent_impls_overlap_check(self, key: ())
Checks all types in the crate for overlap in their inherent impls. Reports errors. Not meant to be used directly outside of coherence.
sourcepub fn orphan_check_impl(self, key: LocalDefId)
pub fn orphan_check_impl(self, key: LocalDefId)
Checks whether all impls in the crate pass the overlap check, returning which impls fail it. If all impls are correct, the returned slice is empty.
sourcepub fn mir_callgraph_reachable(self, key: (Instance<'tcx>, LocalDefId))
pub fn mir_callgraph_reachable(self, key: (Instance<'tcx>, LocalDefId))
Check whether the function has any recursion that could cause the inliner to trigger a cycle. Returns the call stack causing the cycle. The call stack does not contain the current function, just all intermediate functions.
sourcepub fn mir_inliner_callees(self, key: InstanceDef<'tcx>)
pub fn mir_inliner_callees(self, key: InstanceDef<'tcx>)
Obtain all the calls into other local functions
sourcepub fn eval_to_allocation_raw(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
pub fn eval_to_allocation_raw(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
Evaluates a constant and returns the computed allocation.
Do not use this directly, use the tcx.eval_static_initializer
wrapper.
sourcepub fn eval_to_const_value_raw(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
pub fn eval_to_const_value_raw(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
Evaluates const items or anonymous constants (such as enum variant explicit discriminants or array lengths) into a representation suitable for the type system and const generics.
Do not use this directly, use one of the following wrappers: tcx.const_eval_poly
,
tcx.const_eval_resolve
, tcx.const_eval_instance
, or tcx.const_eval_global_id
.
sourcepub fn eval_to_valtree(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
pub fn eval_to_valtree(self, key: ParamEnvAnd<'tcx, GlobalId<'tcx>>)
Evaluate a constant and convert it to a type level constant or
return None
if that is not possible.
sourcepub fn valtree_to_const_val(self, key: (Ty<'tcx>, ValTree<'tcx>))
pub fn valtree_to_const_val(self, key: (Ty<'tcx>, ValTree<'tcx>))
Converts a type level constant value into ConstValue
sourcepub fn destructure_const(self, key: Const<'tcx>)
pub fn destructure_const(self, key: Const<'tcx>)
Destructures array, ADT or tuple constants into the constants of their fields.
sourcepub fn try_destructure_mir_constant(
self,
key: ParamEnvAnd<'tcx, ConstantKind<'tcx>>
)
pub fn try_destructure_mir_constant(
self,
key: ParamEnvAnd<'tcx, ConstantKind<'tcx>>
)
Tries to destructure an mir::ConstantKind
ADT or array into its variant index
and its field values.
sourcepub fn deref_mir_constant(self, key: ParamEnvAnd<'tcx, ConstantKind<'tcx>>)
pub fn deref_mir_constant(self, key: ParamEnvAnd<'tcx, ConstantKind<'tcx>>)
Dereference a constant reference or raw pointer and turn the result into a constant again.
sourcepub fn const_caller_location(self, key: (Symbol, u32, u32))
pub fn const_caller_location(self, key: (Symbol, u32, u32))
[query description - consider adding a doc-comment!] getting a &core::panic::Location referring to a span
sourcepub fn lit_to_const(self, key: LitToConstInput<'tcx>)
pub fn lit_to_const(self, key: LitToConstInput<'tcx>)
[query description - consider adding a doc-comment!] converting literal to const
sourcepub fn lit_to_mir_constant(self, key: LitToConstInput<'tcx>)
pub fn lit_to_mir_constant(self, key: LitToConstInput<'tcx>)
[query description - consider adding a doc-comment!] converting literal to mir constant
sourcepub fn check_match(self, key: impl IntoQueryParam<DefId>)
pub fn check_match(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] match-checking tcx.def_path_str(key)
sourcepub fn effective_visibilities(self, key: ())
pub fn effective_visibilities(self, key: ())
Performs part of the privacy check and computes effective visibilities.
sourcepub fn check_private_in_public(self, key: ())
pub fn check_private_in_public(self, key: ())
[query description - consider adding a doc-comment!] checking for private elements in public interfaces
sourcepub fn reachable_set(self, key: ())
pub fn reachable_set(self, key: ())
[query description - consider adding a doc-comment!] reachability
sourcepub fn region_scope_tree(self, key: impl IntoQueryParam<DefId>)
pub fn region_scope_tree(self, key: impl IntoQueryParam<DefId>)
Per-body region::ScopeTree
. The DefId
should be the owner DefId
for the body;
in the case of closures, this will be redirected to the enclosing function.
sourcepub fn mir_shims(self, key: InstanceDef<'tcx>)
pub fn mir_shims(self, key: InstanceDef<'tcx>)
Generates a MIR body for the shim.
sourcepub fn symbol_name(self, key: Instance<'tcx>)
pub fn symbol_name(self, key: Instance<'tcx>)
The symbol_name
query provides the symbol name for calling a
given instance from the local crate. In particular, it will also
look up the correct symbol name of instances from upstream crates.
sourcepub fn opt_def_kind(self, key: impl IntoQueryParam<DefId>)
pub fn opt_def_kind(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up definition kind of tcx.def_path_str(def_id)
sourcepub fn def_span(self, key: impl IntoQueryParam<DefId>)
pub fn def_span(self, key: impl IntoQueryParam<DefId>)
Gets the span for the definition.
sourcepub fn def_ident_span(self, key: impl IntoQueryParam<DefId>)
pub fn def_ident_span(self, key: impl IntoQueryParam<DefId>)
Gets the span for the identifier of the definition.
sourcepub fn lookup_stability(self, key: impl IntoQueryParam<DefId>)
pub fn lookup_stability(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up stability of tcx.def_path_str(def_id)
sourcepub fn lookup_const_stability(self, key: impl IntoQueryParam<DefId>)
pub fn lookup_const_stability(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up const stability of tcx.def_path_str(def_id)
sourcepub fn lookup_default_body_stability(self, key: impl IntoQueryParam<DefId>)
pub fn lookup_default_body_stability(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up default body stability of tcx.def_path_str(def_id)
sourcepub fn should_inherit_track_caller(self, key: impl IntoQueryParam<DefId>)
pub fn should_inherit_track_caller(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing should_inherit_track_caller of tcx.def_path_str(def_id)
sourcepub fn lookup_deprecation_entry(self, key: impl IntoQueryParam<DefId>)
pub fn lookup_deprecation_entry(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking whether tcx.def_path_str(def_id)
is deprecated
Determines whether an item is annotated with doc(hidden)
.
sourcepub fn is_doc_notable_trait(self, key: impl IntoQueryParam<DefId>)
pub fn is_doc_notable_trait(self, key: impl IntoQueryParam<DefId>)
Determines whether an item is annotated with doc(notable_trait)
.
sourcepub fn item_attrs(self, key: impl IntoQueryParam<DefId>)
pub fn item_attrs(self, key: impl IntoQueryParam<DefId>)
Returns the attributes on the item at def_id
.
Do not use this directly, use tcx.get_attrs
instead.
sourcepub fn codegen_fn_attrs(self, key: impl IntoQueryParam<DefId>)
pub fn codegen_fn_attrs(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing codegen attributes of tcx.def_path_str(def_id)
sourcepub fn asm_target_features(self, key: impl IntoQueryParam<DefId>)
pub fn asm_target_features(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing target features for inline asm of tcx.def_path_str(def_id)
sourcepub fn fn_arg_names(self, key: impl IntoQueryParam<DefId>)
pub fn fn_arg_names(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up function parameter names for tcx.def_path_str(def_id)
sourcepub fn rendered_const(self, key: impl IntoQueryParam<DefId>)
pub fn rendered_const(self, key: impl IntoQueryParam<DefId>)
Gets the rendered value of the specified constant or associated constant. Used by rustdoc.
sourcepub fn impl_parent(self, key: impl IntoQueryParam<DefId>)
pub fn impl_parent(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing specialization parent impl of tcx.def_path_str(def_id)
sourcepub fn is_ctfe_mir_available(self, key: impl IntoQueryParam<DefId>)
pub fn is_ctfe_mir_available(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking if item has CTFE MIR available: tcx.def_path_str(key)
sourcepub fn is_mir_available(self, key: impl IntoQueryParam<DefId>)
pub fn is_mir_available(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking if item has MIR available: tcx.def_path_str(key)
sourcepub fn own_existential_vtable_entries(self, key: impl IntoQueryParam<DefId>)
pub fn own_existential_vtable_entries(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] finding all existential vtable entries for trait tcx.def_path_str(key)
sourcepub fn vtable_entries(self, key: PolyTraitRef<'tcx>)
pub fn vtable_entries(self, key: PolyTraitRef<'tcx>)
[query description - consider adding a doc-comment!] finding all vtable entries for trait tcx.def_path_str(key.def_id())
sourcepub fn vtable_trait_upcasting_coercion_new_vptr_slot(
self,
key: (Ty<'tcx>, Ty<'tcx>)
)
pub fn vtable_trait_upcasting_coercion_new_vptr_slot(
self,
key: (Ty<'tcx>, Ty<'tcx>)
)
[query description - consider adding a doc-comment!] finding the slot within vtable for trait object key.1
vtable ptr during trait upcasting coercion from key.0
vtable
sourcepub fn vtable_allocation(
self,
key: (Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>)
)
pub fn vtable_allocation(
self,
key: (Ty<'tcx>, Option<PolyExistentialTraitRef<'tcx>>)
)
[query description - consider adding a doc-comment!] vtable const allocation for < key.0
as key.1.map(| trait_ref | format! ("{}", trait_ref)).unwrap_or("_".to_owned())
>
sourcepub fn codegen_select_candidate(self, key: (ParamEnv<'tcx>, PolyTraitRef<'tcx>))
pub fn codegen_select_candidate(self, key: (ParamEnv<'tcx>, PolyTraitRef<'tcx>))
[query description - consider adding a doc-comment!] computing candidate for key.1
sourcepub fn all_local_trait_impls(self, key: ())
pub fn all_local_trait_impls(self, key: ())
Return all impl
blocks in the current crate.
sourcepub fn trait_impls_of(self, key: impl IntoQueryParam<DefId>)
pub fn trait_impls_of(self, key: impl IntoQueryParam<DefId>)
Given a trait trait_id
, return all known impl
blocks.
sourcepub fn specialization_graph_of(self, key: impl IntoQueryParam<DefId>)
pub fn specialization_graph_of(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] building specialization graph of trait tcx.def_path_str(trait_id)
sourcepub fn object_safety_violations(self, key: impl IntoQueryParam<DefId>)
pub fn object_safety_violations(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] determining object safety of trait tcx.def_path_str(trait_id)
sourcepub fn param_env(self, key: impl IntoQueryParam<DefId>)
pub fn param_env(self, key: impl IntoQueryParam<DefId>)
Gets the ParameterEnvironment for a given item; this environment
will be in “user-facing” mode, meaning that it is suitable for
type-checking etc, and it does not normalize specializable
associated types. This is almost always what you want,
unless you are doing MIR optimizations, in which case you
might want to use reveal_all()
method to change modes.
sourcepub fn param_env_reveal_all_normalized(self, key: impl IntoQueryParam<DefId>)
pub fn param_env_reveal_all_normalized(self, key: impl IntoQueryParam<DefId>)
Like param_env
, but returns the ParamEnv
in Reveal::All
mode.
Prefer this over tcx.param_env(def_id).with_reveal_all_normalized(tcx)
,
as this method is more efficient.
sourcepub fn is_copy_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn is_copy_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Trait selection queries. These are best used by invoking ty.is_copy_modulo_regions()
,
ty.is_copy()
, etc, since that will prune the environment where possible.
sourcepub fn is_sized_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn is_sized_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Query backing Ty::is_sized
.
sourcepub fn is_freeze_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn is_freeze_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Query backing Ty::is_freeze
.
sourcepub fn is_unpin_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn is_unpin_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Query backing Ty::is_unpin
.
sourcepub fn needs_drop_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn needs_drop_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Query backing Ty::needs_drop
.
sourcepub fn has_significant_drop_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn has_significant_drop_raw(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Query backing Ty::has_significant_drop_raw
.
sourcepub fn has_structural_eq_impls(self, key: Ty<'tcx>)
pub fn has_structural_eq_impls(self, key: Ty<'tcx>)
Query backing Ty::is_structural_eq_shallow
.
This is only correct for ADTs. Call is_structural_eq_shallow
to handle all types
correctly.
sourcepub fn adt_drop_tys(self, key: impl IntoQueryParam<DefId>)
pub fn adt_drop_tys(self, key: impl IntoQueryParam<DefId>)
A list of types where the ADT requires drop if and only if any of
those types require drop. If the ADT is known to always need drop
then Err(AlwaysRequiresDrop)
is returned.
sourcepub fn adt_significant_drop_tys(self, key: impl IntoQueryParam<DefId>)
pub fn adt_significant_drop_tys(self, key: impl IntoQueryParam<DefId>)
A list of types where the ADT requires drop if and only if any of those types
has significant drop. A type marked with the attribute rustc_insignificant_dtor
is considered to not be significant. A drop is significant if it is implemented
by the user or does anything that will have any observable behavior (other than
freeing up memory). If the ADT is known to have a significant destructor then
Err(AlwaysRequiresDrop)
is returned.
sourcepub fn layout_of(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
pub fn layout_of(self, key: ParamEnvAnd<'tcx, Ty<'tcx>>)
Computes the layout of a type. Note that this implicitly executes in “reveal all” mode, and will normalize the input type.
sourcepub fn fn_abi_of_fn_ptr(
self,
key: ParamEnvAnd<'tcx, (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)>
)
pub fn fn_abi_of_fn_ptr(
self,
key: ParamEnvAnd<'tcx, (PolyFnSig<'tcx>, &'tcx List<Ty<'tcx>>)>
)
Compute a FnAbi
suitable for indirect calls, i.e. to fn
pointers.
NB: this doesn’t handle virtual calls - those should use fn_abi_of_instance
instead, where the instance is an InstanceDef::Virtual
.
sourcepub fn fn_abi_of_instance(
self,
key: ParamEnvAnd<'tcx, (Instance<'tcx>, &'tcx List<Ty<'tcx>>)>
)
pub fn fn_abi_of_instance(
self,
key: ParamEnvAnd<'tcx, (Instance<'tcx>, &'tcx List<Ty<'tcx>>)>
)
Compute a FnAbi
suitable for declaring/defining an fn
instance, and for
direct calls to an fn
.
NB: that includes virtual calls, which are represented by “direct calls”
to an InstanceDef::Virtual
instance (of <dyn Trait as Trait>::fn
).
sourcepub fn dylib_dependency_formats(self, key: CrateNum)
pub fn dylib_dependency_formats(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting dylib dependency formats of crate
sourcepub fn dependency_formats(self, key: ())
pub fn dependency_formats(self, key: ())
[query description - consider adding a doc-comment!] getting the linkage format of all dependencies
sourcepub fn is_compiler_builtins(self, key: CrateNum)
pub fn is_compiler_builtins(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if the crate is_compiler_builtins
sourcepub fn has_global_allocator(self, key: CrateNum)
pub fn has_global_allocator(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if the crate has_global_allocator
sourcepub fn has_alloc_error_handler(self, key: CrateNum)
pub fn has_alloc_error_handler(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if the crate has_alloc_error_handler
sourcepub fn has_panic_handler(self, key: CrateNum)
pub fn has_panic_handler(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if the crate has_panic_handler
sourcepub fn is_profiler_runtime(self, key: CrateNum)
pub fn is_profiler_runtime(self, key: CrateNum)
[query description - consider adding a doc-comment!] checking if a crate is #![profiler_runtime]
sourcepub fn has_ffi_unwind_calls(self, key: LocalDefId)
pub fn has_ffi_unwind_calls(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking if tcx.def_path_str(key.to_def_id())
contains FFI-unwind calls
sourcepub fn required_panic_strategy(self, key: CrateNum)
pub fn required_panic_strategy(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting a crate’s required panic strategy
sourcepub fn panic_in_drop_strategy(self, key: CrateNum)
pub fn panic_in_drop_strategy(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting a crate’s configured panic-in-drop strategy
sourcepub fn is_no_builtins(self, key: CrateNum)
pub fn is_no_builtins(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting whether a crate has #![no_builtins]
sourcepub fn symbol_mangling_version(self, key: CrateNum)
pub fn symbol_mangling_version(self, key: CrateNum)
[query description - consider adding a doc-comment!] getting a crate’s symbol mangling version
sourcepub fn extern_crate(self, key: impl IntoQueryParam<DefId>)
pub fn extern_crate(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] getting crate’s ExternCrateData
sourcepub fn specializes(self, key: (DefId, DefId))
pub fn specializes(self, key: (DefId, DefId))
[query description - consider adding a doc-comment!] computing whether impls specialize one another
sourcepub fn in_scope_traits_map(self, key: OwnerId)
pub fn in_scope_traits_map(self, key: OwnerId)
[query description - consider adding a doc-comment!] getting traits in scope at a block
sourcepub fn module_reexports(self, key: LocalDefId)
pub fn module_reexports(self, key: LocalDefId)
[query description - consider adding a doc-comment!] looking up reexports of module tcx.def_path_str(def_id.to_def_id())
sourcepub fn impl_defaultness(self, key: impl IntoQueryParam<DefId>)
pub fn impl_defaultness(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up whether tcx.def_path_str(def_id)
is a default impl
sourcepub fn check_well_formed(self, key: OwnerId)
pub fn check_well_formed(self, key: OwnerId)
[query description - consider adding a doc-comment!] checking that tcx.def_path_str(key.to_def_id())
is well-formed
sourcepub fn reachable_non_generics(self, key: CrateNum)
pub fn reachable_non_generics(self, key: CrateNum)
[query description - consider adding a doc-comment!] looking up the exported symbols of a crate
sourcepub fn is_reachable_non_generic(self, key: impl IntoQueryParam<DefId>)
pub fn is_reachable_non_generic(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] checking whether tcx.def_path_str(def_id)
is an exported symbol
sourcepub fn is_unreachable_local_definition(self, key: LocalDefId)
pub fn is_unreachable_local_definition(self, key: LocalDefId)
[query description - consider adding a doc-comment!] checking whether tcx.def_path_str(def_id.to_def_id())
is reachable from outside the crate
sourcepub fn upstream_monomorphizations(self, key: ())
pub fn upstream_monomorphizations(self, key: ())
The entire set of monomorphizations the local crate can safely link
to because they are exported from upstream crates. Do not depend on
this directly, as its value changes anytime a monomorphization gets
added or removed in any upstream crate. Instead use the narrower
upstream_monomorphizations_for
, upstream_drop_glue_for
, or, even
better, Instance::upstream_monomorphization()
.
sourcepub fn upstream_monomorphizations_for(self, key: impl IntoQueryParam<DefId>)
pub fn upstream_monomorphizations_for(self, key: impl IntoQueryParam<DefId>)
Returns the set of upstream monomorphizations available for the
generic function identified by the given def_id
. The query makes
sure to make a stable selection if the same monomorphization is
available in multiple upstream crates.
You likely want to call Instance::upstream_monomorphization()
instead of invoking this query directly.
sourcepub fn upstream_drop_glue_for(self, key: SubstsRef<'tcx>)
pub fn upstream_drop_glue_for(self, key: SubstsRef<'tcx>)
Returns the upstream crate that exports drop-glue for the given
type (substs
is expected to be a single-item list containing the
type one wants drop-glue for).
This is a subset of upstream_monomorphizations_for
in order to
increase dep-tracking granularity. Otherwise adding or removing any
type with drop-glue in any upstream crate would invalidate all
functions calling drop-glue of an upstream type.
You likely want to call Instance::upstream_monomorphization()
instead of invoking this query directly.
NOTE: This query could easily be extended to also support other
common functions that have are large set of monomorphizations
(like Clone::clone
for example).
sourcepub fn foreign_modules(self, key: CrateNum)
pub fn foreign_modules(self, key: CrateNum)
Returns a list of all extern
blocks of a crate.
sourcepub fn entry_fn(self, key: ())
pub fn entry_fn(self, key: ())
Identifies the entry-point (e.g., the main
function) for a given
crate, returning None
if there is no entry point (such as for library crates).
sourcepub fn proc_macro_decls_static(self, key: ())
pub fn proc_macro_decls_static(self, key: ())
Finds the rustc_proc_macro_decls
item of a crate.
sourcepub fn crate_hash(self, key: CrateNum)
pub fn crate_hash(self, key: CrateNum)
[query description - consider adding a doc-comment!] looking up the hash a crate
sourcepub fn crate_host_hash(self, key: CrateNum)
pub fn crate_host_hash(self, key: CrateNum)
Gets the hash for the host proc macro. Used to support -Z dual-proc-macro.
sourcepub fn extra_filename(self, key: CrateNum)
pub fn extra_filename(self, key: CrateNum)
Gets the extra data to put in each output filename for a crate.
For example, compiling the foo
crate with extra-filename=-a
creates a libfoo-b.rlib
file.
sourcepub fn crate_extern_paths(self, key: CrateNum)
pub fn crate_extern_paths(self, key: CrateNum)
Gets the paths where the crate came from in the file system.
sourcepub fn implementations_of_trait(self, key: (CrateNum, DefId))
pub fn implementations_of_trait(self, key: (CrateNum, DefId))
Given a crate and a trait, look up all impls of that trait in the crate.
Return (impl_id, self_ty)
.
sourcepub fn crate_incoherent_impls(self, key: (CrateNum, SimplifiedType))
pub fn crate_incoherent_impls(self, key: (CrateNum, SimplifiedType))
Collects all incoherent impls for the given crate and type.
Do not call this directly, but instead use the incoherent_impls
query.
This query is only used to get the data necessary for that query.
sourcepub fn native_library(self, key: impl IntoQueryParam<DefId>)
pub fn native_library(self, key: impl IntoQueryParam<DefId>)
Get the corresponding native library from the native_libraries
query
sourcepub fn resolve_lifetimes(self, key: OwnerId)
pub fn resolve_lifetimes(self, key: OwnerId)
Does lifetime resolution on items. Importantly, we can’t resolve lifetimes directly on things like trait methods, because of trait params. See `rustc_resolve::late::lifetimes for details.
sourcepub fn named_region_map(self, key: OwnerId)
pub fn named_region_map(self, key: OwnerId)
[query description - consider adding a doc-comment!] looking up a named region
sourcepub fn is_late_bound_map(self, key: LocalDefId)
pub fn is_late_bound_map(self, key: LocalDefId)
[query description - consider adding a doc-comment!] testing if a region is late bound
sourcepub fn object_lifetime_default(self, key: impl IntoQueryParam<DefId>)
pub fn object_lifetime_default(self, key: impl IntoQueryParam<DefId>)
For a given item’s generic parameter, gets the default lifetimes to be used
for each parameter if a trait object were to be passed for that parameter.
For example, for T
in struct Foo<'a, T>
, this would be 'static
.
For T
in struct Foo<'a, T: 'a>
, this would instead be 'a
.
This query will panic if passed something that is not a type parameter.
sourcepub fn late_bound_vars_map(self, key: OwnerId)
pub fn late_bound_vars_map(self, key: OwnerId)
[query description - consider adding a doc-comment!] looking up late bound vars
sourcepub fn visibility(self, key: impl IntoQueryParam<DefId>)
pub fn visibility(self, key: impl IntoQueryParam<DefId>)
Computes the visibility of the provided def_id
.
If the item from the def_id
doesn’t have a visibility, it will panic. For example
a generic type parameter will panic if you call this method on it:
use std::fmt::Debug;
pub trait Foo<T: Debug> {}
In here, if you call visibility
on T
, it’ll panic.
sourcepub fn inhabited_predicate_adt(self, key: impl IntoQueryParam<DefId>)
pub fn inhabited_predicate_adt(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] computing the uninhabited predicate of {:?}
sourcepub fn inhabited_predicate_type(self, key: Ty<'tcx>)
pub fn inhabited_predicate_type(self, key: Ty<'tcx>)
Do not call this query directly: invoke Ty::inhabited_predicate
instead.
sourcepub fn dep_kind(self, key: CrateNum)
pub fn dep_kind(self, key: CrateNum)
[query description - consider adding a doc-comment!] fetching what a dependency looks like
sourcepub fn crate_name(self, key: CrateNum)
pub fn crate_name(self, key: CrateNum)
Gets the name of the crate.
sourcepub fn module_children(self, key: impl IntoQueryParam<DefId>)
pub fn module_children(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] collecting child items of module tcx.def_path_str(def_id)
sourcepub fn extern_mod_stmt_cnum(self, key: LocalDefId)
pub fn extern_mod_stmt_cnum(self, key: LocalDefId)
[query description - consider adding a doc-comment!] computing crate imported by tcx.def_path_str(def_id.to_def_id())
sourcepub fn lib_features(self, key: ())
pub fn lib_features(self, key: ())
[query description - consider adding a doc-comment!] calculating the lib features map
sourcepub fn defined_lib_features(self, key: CrateNum)
pub fn defined_lib_features(self, key: CrateNum)
[query description - consider adding a doc-comment!] calculating the lib features defined in a crate
sourcepub fn stability_implications(self, key: CrateNum)
pub fn stability_implications(self, key: CrateNum)
[query description - consider adding a doc-comment!] calculating the implications between #[unstable]
features defined in a crate
sourcepub fn is_intrinsic(self, key: impl IntoQueryParam<DefId>)
pub fn is_intrinsic(self, key: impl IntoQueryParam<DefId>)
Whether the function is an intrinsic
sourcepub fn get_lang_items(self, key: ())
pub fn get_lang_items(self, key: ())
Returns the lang items defined in another crate by loading it from metadata.
sourcepub fn all_diagnostic_items(self, key: ())
pub fn all_diagnostic_items(self, key: ())
Returns all diagnostic items defined in all crates.
sourcepub fn defined_lang_items(self, key: CrateNum)
pub fn defined_lang_items(self, key: CrateNum)
Returns the lang items defined in another crate by loading it from metadata.
sourcepub fn diagnostic_items(self, key: CrateNum)
pub fn diagnostic_items(self, key: CrateNum)
Returns the diagnostic items defined in a crate.
sourcepub fn missing_lang_items(self, key: CrateNum)
pub fn missing_lang_items(self, key: CrateNum)
[query description - consider adding a doc-comment!] calculating the missing lang items in a crate
sourcepub fn visible_parent_map(self, key: ())
pub fn visible_parent_map(self, key: ())
[query description - consider adding a doc-comment!] calculating the visible parent map
sourcepub fn trimmed_def_paths(self, key: ())
pub fn trimmed_def_paths(self, key: ())
[query description - consider adding a doc-comment!] calculating trimmed def paths
sourcepub fn missing_extern_crate_item(self, key: CrateNum)
pub fn missing_extern_crate_item(self, key: CrateNum)
[query description - consider adding a doc-comment!] seeing if we’re missing an extern crate
item for this crate
sourcepub fn used_crate_source(self, key: CrateNum)
pub fn used_crate_source(self, key: CrateNum)
[query description - consider adding a doc-comment!] looking at the source for a crate
sourcepub fn debugger_visualizers(self, key: CrateNum)
pub fn debugger_visualizers(self, key: CrateNum)
Returns the debugger visualizers defined for this crate.
sourcepub fn postorder_cnums(self, key: ())
pub fn postorder_cnums(self, key: ())
[query description - consider adding a doc-comment!] generating a postorder list of CrateNums
sourcepub fn is_private_dep(self, key: CrateNum)
pub fn is_private_dep(self, key: CrateNum)
Returns whether or not the crate with CrateNum ‘cnum’ is marked as a private dependency
sourcepub fn allocator_kind(self, key: ())
pub fn allocator_kind(self, key: ())
[query description - consider adding a doc-comment!] getting the allocator kind for the current crate
sourcepub fn alloc_error_handler_kind(self, key: ())
pub fn alloc_error_handler_kind(self, key: ())
[query description - consider adding a doc-comment!] alloc error handler kind for the current crate
sourcepub fn upvars_mentioned(self, key: impl IntoQueryParam<DefId>)
pub fn upvars_mentioned(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] collecting upvars mentioned in tcx.def_path_str(def_id)
sourcepub fn maybe_unused_trait_imports(self, key: ())
pub fn maybe_unused_trait_imports(self, key: ())
[query description - consider adding a doc-comment!] fetching potentially unused trait imports
sourcepub fn maybe_unused_extern_crates(self, key: ())
pub fn maybe_unused_extern_crates(self, key: ())
[query description - consider adding a doc-comment!] looking up all possibly unused extern crates
sourcepub fn names_imported_by_glob_use(self, key: LocalDefId)
pub fn names_imported_by_glob_use(self, key: LocalDefId)
[query description - consider adding a doc-comment!] finding names imported by glob use for tcx.def_path_str(def_id.to_def_id())
sourcepub fn stability_index(self, key: ())
pub fn stability_index(self, key: ())
[query description - consider adding a doc-comment!] calculating the stability index for the local crate
sourcepub fn crates(self, key: ())
pub fn crates(self, key: ())
[query description - consider adding a doc-comment!] fetching all foreign CrateNum instances
sourcepub fn traits_in_crate(self, key: CrateNum)
pub fn traits_in_crate(self, key: CrateNum)
A list of all traits in a crate, used by rustdoc and error reporting.
NOTE: Not named just traits
due to a naming conflict.
sourcepub fn exported_symbols(self, key: CrateNum)
pub fn exported_symbols(self, key: CrateNum)
The list of symbols exported from the given crate.
- All names contained in
exported_symbols(cnum)
are guaranteed to correspond to a publicly visible symbol incnum
machine code. - The
exported_symbols
sets of different crates do not intersect.
sourcepub fn collect_and_partition_mono_items(self, key: ())
pub fn collect_and_partition_mono_items(self, key: ())
[query description - consider adding a doc-comment!] collect_and_partition_mono_items
sourcepub fn is_codegened_item(self, key: impl IntoQueryParam<DefId>)
pub fn is_codegened_item(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] determining whether tcx.def_path_str(def_id)
needs codegen
sourcepub fn codegened_and_inlined_items(self, key: ())
pub fn codegened_and_inlined_items(self, key: ())
All items participating in code generation together with items inlined into them.
sourcepub fn codegen_unit(self, key: Symbol)
pub fn codegen_unit(self, key: Symbol)
[query description - consider adding a doc-comment!] getting codegen unit {sym}
sourcepub fn unused_generic_params(self, key: InstanceDef<'tcx>)
pub fn unused_generic_params(self, key: InstanceDef<'tcx>)
[query description - consider adding a doc-comment!] determining which generic parameters are unused by tcx.def_path_str(key.def_id())
sourcepub fn backend_optimization_level(self, key: ())
pub fn backend_optimization_level(self, key: ())
[query description - consider adding a doc-comment!] optimization level used by backend
sourcepub fn output_filenames(self, key: ())
pub fn output_filenames(self, key: ())
Return the filenames where output artefacts shall be stored.
This query returns an &Arc
because codegen backends need the value even after the TyCtxt
has been destroyed.
sourcepub fn normalize_projection_ty(self, key: CanonicalProjectionGoal<'tcx>)
pub fn normalize_projection_ty(self, key: CanonicalProjectionGoal<'tcx>)
Do not call this query directly: invoke normalize
instead.
sourcepub fn try_normalize_generic_arg_after_erasing_regions(
self,
key: ParamEnvAnd<'tcx, GenericArg<'tcx>>
)
pub fn try_normalize_generic_arg_after_erasing_regions(
self,
key: ParamEnvAnd<'tcx, GenericArg<'tcx>>
)
Do not call this query directly: invoke try_normalize_erasing_regions
instead.
sourcepub fn implied_outlives_bounds(self, key: CanonicalTyGoal<'tcx>)
pub fn implied_outlives_bounds(self, key: CanonicalTyGoal<'tcx>)
[query description - consider adding a doc-comment!] computing implied outlives bounds for goal.value.value
sourcepub fn dropck_outlives(self, key: CanonicalTyGoal<'tcx>)
pub fn dropck_outlives(self, key: CanonicalTyGoal<'tcx>)
Do not call this query directly:
invoke DropckOutlives::new(dropped_ty)).fully_perform(typeck.infcx)
instead.
sourcepub fn evaluate_obligation(self, key: CanonicalPredicateGoal<'tcx>)
pub fn evaluate_obligation(self, key: CanonicalPredicateGoal<'tcx>)
Do not call this query directly: invoke infcx.predicate_may_hold()
or
infcx.predicate_must_hold()
instead.
sourcepub fn evaluate_goal(self, key: CanonicalChalkEnvironmentAndGoal<'tcx>)
pub fn evaluate_goal(self, key: CanonicalChalkEnvironmentAndGoal<'tcx>)
[query description - consider adding a doc-comment!] evaluating trait selection obligation goal.value
sourcepub fn type_op_ascribe_user_type(
self,
key: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
)
pub fn type_op_ascribe_user_type(
self,
key: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
)
Do not call this query directly: part of the Eq
type-op
sourcepub fn type_op_eq(self, key: CanonicalTypeOpEqGoal<'tcx>)
pub fn type_op_eq(self, key: CanonicalTypeOpEqGoal<'tcx>)
Do not call this query directly: part of the Eq
type-op
sourcepub fn type_op_subtype(self, key: CanonicalTypeOpSubtypeGoal<'tcx>)
pub fn type_op_subtype(self, key: CanonicalTypeOpSubtypeGoal<'tcx>)
Do not call this query directly: part of the Subtype
type-op
sourcepub fn type_op_prove_predicate(
self,
key: CanonicalTypeOpProvePredicateGoal<'tcx>
)
pub fn type_op_prove_predicate(
self,
key: CanonicalTypeOpProvePredicateGoal<'tcx>
)
Do not call this query directly: part of the ProvePredicate
type-op
sourcepub fn type_op_normalize_ty(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
)
pub fn type_op_normalize_ty(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>
)
Do not call this query directly: part of the Normalize
type-op
sourcepub fn type_op_normalize_predicate(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, Predicate<'tcx>>
)
pub fn type_op_normalize_predicate(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, Predicate<'tcx>>
)
Do not call this query directly: part of the Normalize
type-op
sourcepub fn type_op_normalize_poly_fn_sig(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>
)
pub fn type_op_normalize_poly_fn_sig(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>
)
Do not call this query directly: part of the Normalize
type-op
sourcepub fn type_op_normalize_fn_sig(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>
)
pub fn type_op_normalize_fn_sig(
self,
key: CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>
)
Do not call this query directly: part of the Normalize
type-op
sourcepub fn subst_and_check_impossible_predicates(self, key: (DefId, SubstsRef<'tcx>))
pub fn subst_and_check_impossible_predicates(self, key: (DefId, SubstsRef<'tcx>))
[query description - consider adding a doc-comment!] checking impossible substituted predicates: tcx.def_path_str(key.0)
sourcepub fn is_impossible_method(self, key: (DefId, DefId))
pub fn is_impossible_method(self, key: (DefId, DefId))
[query description - consider adding a doc-comment!] checking if tcx.def_path_str(key.1)
is impossible to call within tcx.def_path_str(key.0)
sourcepub fn method_autoderef_steps(self, key: CanonicalTyGoal<'tcx>)
pub fn method_autoderef_steps(self, key: CanonicalTyGoal<'tcx>)
[query description - consider adding a doc-comment!] computing autoderef types for goal.value.value
sourcepub fn supported_target_features(self, key: CrateNum)
pub fn supported_target_features(self, key: CrateNum)
[query description - consider adding a doc-comment!] looking up supported target features
sourcepub fn instance_def_size_estimate(self, key: InstanceDef<'tcx>)
pub fn instance_def_size_estimate(self, key: InstanceDef<'tcx>)
Get an estimate of the size of an InstanceDef based on its MIR for CGU partitioning.
sourcepub fn features_query(self, key: ())
pub fn features_query(self, key: ())
[query description - consider adding a doc-comment!] looking up enabled feature gates
sourcepub fn resolve_instance(self, key: ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>)
pub fn resolve_instance(self, key: ParamEnvAnd<'tcx, (DefId, SubstsRef<'tcx>)>)
Attempt to resolve the given DefId
to an Instance
, for the
given generics args (SubstsRef
), returning one of:
Ok(Some(instance))
on successOk(None)
when theSubstsRef
are still too generic, and therefore don’t allow finding the finalInstance
Err(ErrorGuaranteed)
when theInstance
resolution process couldn’t complete due to errors elsewhere - this is distinct fromOk(None)
to avoid misleading diagnostics when an error has already been/will be emitted, for the original cause
sourcepub fn resolve_instance_of_const_arg(
self,
key: ParamEnvAnd<'tcx, (LocalDefId, DefId, SubstsRef<'tcx>)>
)
pub fn resolve_instance_of_const_arg(
self,
key: ParamEnvAnd<'tcx, (LocalDefId, DefId, SubstsRef<'tcx>)>
)
[query description - consider adding a doc-comment!] resolving instance of the const argument ty :: Instance :: new(key.value.0.to_def_id(), key.value.2)
sourcepub fn reveal_opaque_types_in_bounds(self, key: &'tcx List<Predicate<'tcx>>)
pub fn reveal_opaque_types_in_bounds(self, key: &'tcx List<Predicate<'tcx>>)
[query description - consider adding a doc-comment!] revealing opaque types in {:?}
sourcepub fn limits(self, key: ())
pub fn limits(self, key: ())
[query description - consider adding a doc-comment!] looking up limits
sourcepub fn diagnostic_hir_wf_check(self, key: (Predicate<'tcx>, WellFormedLoc))
pub fn diagnostic_hir_wf_check(self, key: (Predicate<'tcx>, WellFormedLoc))
Performs an HIR-based well-formed check on the item with the given HirId
. If
we get an Unimplemented
error that matches the provided Predicate
, return
the cause of the newly created obligation.
This is only used by error-reporting code to get a better cause (in particular, a better
span) for an existing error. Therefore, it is best-effort, and may never handle
all of the cases that the normal ty::Ty
-based wfcheck does. This is fine,
because the ty::Ty
-based wfcheck is always run.
sourcepub fn global_backend_features(self, key: ())
pub fn global_backend_features(self, key: ())
The list of backend features computed from CLI flags (-Ctarget-cpu
, -Ctarget-feature
,
--target
and similar).
sourcepub fn generator_diagnostic_data(self, key: impl IntoQueryParam<DefId>)
pub fn generator_diagnostic_data(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] looking up generator diagnostic data of tcx.def_path_str(key)
sourcepub fn permits_uninit_init(self, key: TyAndLayout<'tcx>)
pub fn permits_uninit_init(self, key: TyAndLayout<'tcx>)
[query description - consider adding a doc-comment!] checking to see if key.ty
permits being left uninit
sourcepub fn permits_zero_init(self, key: TyAndLayout<'tcx>)
pub fn permits_zero_init(self, key: TyAndLayout<'tcx>)
[query description - consider adding a doc-comment!] checking to see if key.ty
permits being left zeroed
sourcepub fn compare_assoc_const_impl_item_with_trait_item(
self,
key: (LocalDefId, DefId)
)
pub fn compare_assoc_const_impl_item_with_trait_item(
self,
key: (LocalDefId, DefId)
)
[query description - consider adding a doc-comment!] checking assoc const tcx.def_path_str(key.0.to_def_id())
has the same type as trait item
sourcepub fn deduced_param_attrs(self, key: impl IntoQueryParam<DefId>)
pub fn deduced_param_attrs(self, key: impl IntoQueryParam<DefId>)
[query description - consider adding a doc-comment!] deducing parameter attributes for tcx.def_path_str(def_id)
Trait Implementations§
source§impl<'tcx> Clone for TyCtxtEnsure<'tcx>
impl<'tcx> Clone for TyCtxtEnsure<'tcx>
source§fn clone(&self) -> TyCtxtEnsure<'tcx>
fn clone(&self) -> TyCtxtEnsure<'tcx>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl<'tcx> Copy for TyCtxtEnsure<'tcx>
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for TyCtxtEnsure<'tcx>
impl<'tcx> !Send for TyCtxtEnsure<'tcx>
impl<'tcx> !Sync for TyCtxtEnsure<'tcx>
impl<'tcx> Unpin for TyCtxtEnsure<'tcx>
impl<'tcx> !UnwindSafe for TyCtxtEnsure<'tcx>
Blanket Implementations§
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>(
arena: &'a Arena<'tcx>,
iter: impl IntoIterator<Item = T>
) -> &'a mut [T] ⓘ
source§impl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo]) -> T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes