Struct rustc_middle::ty::context::TyCtxtFeed
source · 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, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
sourcepub fn resolutions(self, value: resolutions<'tcx>) -> &'tcx ResolverGlobalCtxt
pub fn resolutions(self, value: resolutions<'tcx>) -> &'tcx ResolverGlobalCtxt
[query description - consider adding a doc-comment!] getting the resolver outputs
source§impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<LocalDefId> + Copy> TyCtxtFeed<'tcx, K>
sourcepub fn opt_local_def_id_to_hir_id(
self,
value: opt_local_def_id_to_hir_id<'tcx>
) -> Option<HirId>
pub fn opt_local_def_id_to_hir_id( self, value: opt_local_def_id_to_hir_id<'tcx> ) -> Option<HirId>
Gives access to the HIR ID for the given LocalDefId
owner key
if any.
Definitions that were generated with no HIR, would be feeded to return None
.
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: generics_of<'tcx>) -> &'tcx Generics
pub fn generics_of(self, value: generics_of<'tcx>) -> &'tcx Generics
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 explicit_item_bounds(
self,
value: explicit_item_bounds<'tcx>
) -> &'tcx [(Predicate<'tcx>, Span)]
pub fn explicit_item_bounds( self, value: explicit_item_bounds<'tcx> ) -> &'tcx [(Predicate<'tcx>, Span)]
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.
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: explicit_predicates_of<'tcx>
) -> GenericPredicates<'tcx>
pub fn explicit_predicates_of( self, value: explicit_predicates_of<'tcx> ) -> GenericPredicates<'tcx>
Returns the predicates written explicitly by the user.
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: inferred_outlives_of<'tcx>
) -> &'tcx [(Clause<'tcx>, Span)]
pub fn inferred_outlives_of( self, value: inferred_outlives_of<'tcx> ) -> &'tcx [(Clause<'tcx>, Span)]
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 associated_item(self, value: associated_item<'tcx>) -> AssocItem
pub fn associated_item(self, value: associated_item<'tcx>) -> AssocItem
Maps from a trait item to the trait item “descriptor”.
source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
sourcepub fn opt_def_kind(self, value: opt_def_kind<'tcx>) -> Option<DefKind>
pub fn opt_def_kind(self, value: opt_def_kind<'tcx>) -> Option<DefKind>
[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 opt_rpitit_info(
self,
value: opt_rpitit_info<'tcx>
) -> Option<ImplTraitInTraitData>
pub fn opt_rpitit_info( self, value: opt_rpitit_info<'tcx> ) -> Option<ImplTraitInTraitData>
The opt_rpitit_info
query returns the pair of the def id of the function where the RPIT
is defined and the opaque def id if any.
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 def_ident_span(self, value: def_ident_span<'tcx>) -> Option<Span>
pub fn def_ident_span(self, value: def_ident_span<'tcx>) -> Option<Span>
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 impl_defaultness(self, value: impl_defaultness<'tcx>) -> Defaultness
pub fn impl_defaultness(self, value: impl_defaultness<'tcx>) -> Defaultness
[query description - consider adding a doc-comment!] looking up whether tcx.def_path_str(def_id)
is a default impl
source§impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<DefId> + Copy> TyCtxtFeed<'tcx, K>
sourcepub fn visibility(self, value: visibility<'tcx>) -> Visibility<DefId>
pub fn visibility(self, value: visibility<'tcx>) -> Visibility<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.
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: crate_name<'tcx>) -> Symbol
pub fn crate_name(self, value: crate_name<'tcx>) -> Symbol
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: output_filenames<'tcx>
) -> &'tcx Arc<OutputFilenames>
pub fn output_filenames( self, value: output_filenames<'tcx> ) -> &'tcx Arc<OutputFilenames>
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: features_query<'tcx>) -> &'tcx Features
pub fn features_query(self, value: features_query<'tcx>) -> &'tcx Features
[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 metadata_loader(
self,
value: metadata_loader<'tcx>
) -> &'tcx Steal<Box<MetadataLoaderDyn>>
pub fn metadata_loader( self, value: metadata_loader<'tcx> ) -> &'tcx Steal<Box<MetadataLoaderDyn>>
[query description - consider adding a doc-comment!] raw operations for metadata file access
source§impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
impl<'tcx, K: IntoQueryParam<()> + Copy> TyCtxtFeed<'tcx, K>
sourcepub fn crate_for_resolver(
self,
value: crate_for_resolver<'tcx>
) -> &'tcx Steal<Crate>
pub fn crate_for_resolver( self, value: crate_for_resolver<'tcx> ) -> &'tcx Steal<Crate>
[query description - consider adding a doc-comment!] the ast before macro expansion and name resolution
source§impl<'tcx> TyCtxtFeed<'tcx, LocalDefId>
impl<'tcx> TyCtxtFeed<'tcx, LocalDefId>
pub fn def_id(&self) -> LocalDefId
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>
Auto Trait Implementations§
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<'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> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
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, D> Value<Tcx, D> for Twhere
Tcx: DepContext,
D: DepKind,
impl<Tcx, T, D> Value<Tcx, D> for Twhere Tcx: DepContext, D: DepKind,
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo<D>]) -> T
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.