pub struct TyCtxtFeed<'tcx, KEY: Copy> {
pub tcx: TyCtxt<'tcx>,
key: KEY,
}
Expand description
This struct should only be created by create_def
.
Fields§
§tcx: TyCtxt<'tcx>
§key: KEY
Implementations§
Source§impl<'tcx, KEY: Copy> TyCtxtFeed<'tcx, KEY>
impl<'tcx, KEY: Copy> TyCtxtFeed<'tcx, KEY>
Source§impl<'tcx> TyCtxtFeed<'tcx, LocalDefId>
impl<'tcx> TyCtxtFeed<'tcx, LocalDefId>
pub fn def_id(&self) -> LocalDefId
pub fn feed_owner_id(&self) -> TyCtxtFeed<'tcx, OwnerId>
pub fn feed_hir(&self)
Source§impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn local_def_id_to_hir_id(self, value: ProvidedValue<'tcx>)
pub fn local_def_id_to_hir_id(self, value: ProvidedValue<'tcx>)
Returns HIR ID for the given LocalDefId
.
Source§impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn opt_hir_owner_nodes(self, value: ProvidedValue<'tcx>)
pub fn opt_hir_owner_nodes(self, value: ProvidedValue<'tcx>)
Gives access to the HIR nodes and bodies inside key
if it’s a HIR owner.
This can be conveniently accessed by methods on tcx.hir()
.
Avoid calling this query directly.
Source§impl<'tcx, K: IntoQueryParam<OwnerId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<OwnerId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn hir_attrs(self, value: ProvidedValue<'tcx>)
pub fn hir_attrs(self, value: ProvidedValue<'tcx>)
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.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn generics_of(self, value: ProvidedValue<'tcx>)
pub fn generics_of(self, value: ProvidedValue<'tcx>)
Maps from the DefId
of an item (trait/struct/enum/fn) to its
associated generics.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn predicates_of(self, value: ProvidedValue<'tcx>)
pub fn predicates_of(self, value: ProvidedValue<'tcx>)
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.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn explicit_item_bounds(self, value: ProvidedValue<'tcx>)
pub fn explicit_item_bounds(self, value: ProvidedValue<'tcx>)
Returns the list of bounds that are required to be satisfied by a implementation or definition. For associated types, these must be satisfied for an implementation to be well-formed, and for opaque types, these are required to be satisfied by the hidden-type of the opaque.
Syntactially, these are the bounds written on the trait’s type
definition, or those after the impl
keyword for an opaque:
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.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn explicit_item_super_predicates(self, value: ProvidedValue<'tcx>)
pub fn explicit_item_super_predicates(self, value: ProvidedValue<'tcx>)
The set of item bounds (see TyCtxt::explicit_item_bounds
) that
share the Self
type of the item. These are a subset of the bounds
that may explicitly be used for things like closure signature
deduction.
Source§impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn mir_built(self, value: ProvidedValue<'tcx>)
pub fn mir_built(self, value: ProvidedValue<'tcx>)
Build the MIR for a given DefId
and prepare it for const qualification.
See the rustc dev guide for more info.
Source§impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn coverage_attr_on(self, value: ProvidedValue<'tcx>)
pub fn coverage_attr_on(self, value: ProvidedValue<'tcx>)
Checks for the nearest #[coverage(off)]
or #[coverage(on)]
on
this def and any enclosing defs, up to the crate root.
Returns false
if #[coverage(off)]
was found, or true
if
either #[coverage(on)]
or no coverage attribute was found.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn explicit_predicates_of(self, value: ProvidedValue<'tcx>)
pub fn explicit_predicates_of(self, value: ProvidedValue<'tcx>)
Returns the predicates written explicitly by the user.
You should probably use predicates_of
unless you’re looking for
predicates with explicit spans for diagnostics purposes.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn inferred_outlives_of(self, value: ProvidedValue<'tcx>)
pub fn inferred_outlives_of(self, value: ProvidedValue<'tcx>)
Returns the inferred outlives predicates (e.g., for struct Foo<'a, T> { x: &'a T }
, this would return T: 'a
).
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn constness(self, value: ProvidedValue<'tcx>)
pub fn constness(self, value: ProvidedValue<'tcx>)
Returns true
if this is a const fn / const impl.
Do not call this function manually. It is only meant to cache the base data for the
higher-level functions. Consider using is_const_fn
or is_const_trait_impl
instead.
Also note that neither of them takes into account feature gates and stability.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn coroutine_kind(self, value: ProvidedValue<'tcx>)
pub fn coroutine_kind(self, value: ProvidedValue<'tcx>)
Returns Some(coroutine_kind)
if the node pointed to by def_id
is a coroutine.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn associated_item(self, value: ProvidedValue<'tcx>)
pub fn associated_item(self, value: ProvidedValue<'tcx>)
Maps from a trait/impl item to the trait/impl item “descriptor”.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn eval_static_initializer(self, value: ProvidedValue<'tcx>)
pub fn eval_static_initializer(self, value: ProvidedValue<'tcx>)
Evaluate a static’s initializer, returning the allocation of the initializer’s memory.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn def_kind(self, value: ProvidedValue<'tcx>)
pub fn def_kind(self, value: ProvidedValue<'tcx>)
[query description - consider adding a doc-comment!] looking up definition kind of tcx.def_path_str(def_id)
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn def_span(self, value: ProvidedValue<'tcx>)
pub fn def_span(self, value: ProvidedValue<'tcx>)
Gets the span for the definition.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn def_ident_span(self, value: ProvidedValue<'tcx>)
pub fn def_ident_span(self, value: ProvidedValue<'tcx>)
Gets the span for the identifier of the definition.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn codegen_fn_attrs(self, value: ProvidedValue<'tcx>)
pub fn codegen_fn_attrs(self, value: ProvidedValue<'tcx>)
[query description - consider adding a doc-comment!] computing codegen attributes of tcx.def_path_str(def_id)
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn param_env(self, value: ProvidedValue<'tcx>)
pub fn param_env(self, value: ProvidedValue<'tcx>)
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.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn defaultness(self, value: ProvidedValue<'tcx>)
pub fn defaultness(self, value: ProvidedValue<'tcx>)
Returns whether the impl or associated function has the default
keyword.
Source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn visibility(self, value: ProvidedValue<'tcx>)
pub fn visibility(self, value: ProvidedValue<'tcx>)
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.
Source§impl<'tcx, K: IntoQueryParam<CrateNum> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<CrateNum> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn crate_name(self, value: ProvidedValue<'tcx>)
pub fn crate_name(self, value: ProvidedValue<'tcx>)
Gets the name of the crate.
Source§impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn output_filenames(self, value: ProvidedValue<'tcx>)
pub fn output_filenames(self, value: ProvidedValue<'tcx>)
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.
Source§impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn features_query(self, value: ProvidedValue<'tcx>)
pub fn features_query(self, value: ProvidedValue<'tcx>)
[query description - consider adding a doc-comment!] looking up enabled feature gates
Source§impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
Sourcepub fn crate_for_resolver(self, value: ProvidedValue<'tcx>)
pub fn crate_for_resolver(self, value: ProvidedValue<'tcx>)
[query description - consider adding a doc-comment!] the ast before macro expansion and name resolution
Trait Implementations§
Source§impl<'tcx, KEY: Clone + Copy> Clone for TyCtxtFeed<'tcx, KEY>
impl<'tcx, KEY: Clone + Copy> Clone for TyCtxtFeed<'tcx, KEY>
Source§fn clone(&self) -> TyCtxtFeed<'tcx, KEY>
fn clone(&self) -> TyCtxtFeed<'tcx, KEY>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl<'tcx, KEY: Copy + Copy> Copy for TyCtxtFeed<'tcx, KEY>
impl<KEY: Copy, CTX> !HashStable<CTX> for TyCtxtFeed<'_, KEY>
Never return a Feed
from a query. Only queries that create a DefId
are
allowed to feed queries for that DefId
.
Auto Trait Implementations§
impl<'tcx, KEY> DynSend for TyCtxtFeed<'tcx, KEY>where
KEY: DynSend,
impl<'tcx, KEY> DynSync for TyCtxtFeed<'tcx, KEY>where
KEY: DynSync,
impl<'tcx, KEY> Freeze for TyCtxtFeed<'tcx, KEY>where
KEY: Freeze,
impl<'tcx, KEY> !RefUnwindSafe for TyCtxtFeed<'tcx, KEY>
impl<'tcx, KEY> !Send for TyCtxtFeed<'tcx, KEY>
impl<'tcx, KEY> !Sync for TyCtxtFeed<'tcx, KEY>
impl<'tcx, KEY> Unpin for TyCtxtFeed<'tcx, KEY>where
KEY: Unpin,
impl<'tcx, KEY> !UnwindSafe for TyCtxtFeed<'tcx, KEY>
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(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
Source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on(self, arena: &'tcx Arena<'tcx>) -> &'tcx mut T
fn allocate_from_iter( arena: &'tcx Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'tcx mut [T]
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.