pub type Key<'tcx> = DefId;
Aliased Type§
struct Key<'tcx> {
pub index: DefIndex,
pub krate: CrateNum,
}
Fields§
§index: DefIndex
§krate: CrateNum
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
Implementations
Source§impl DefId
impl DefId
Sourcepub fn is_local(self) -> bool
pub fn is_local(self) -> bool
Returns whether the item is defined in the crate currently being compiled.
pub fn as_local(self) -> Option<LocalDefId>
pub fn expect_local(self) -> LocalDefId
pub fn is_crate_root(self) -> bool
pub fn as_crate_root(self) -> Option<CrateNum>
pub fn is_top_level_module(self) -> bool
Trait Implementations
Source§impl AsLocalKey for DefId
impl AsLocalKey for DefId
type LocalKey = LocalDefId
Source§fn as_local_key(&self) -> Option<Self::LocalKey>
fn as_local_key(&self) -> Option<Self::LocalKey>
Given an instance of this key, what crate is it referring to?
This is used to find the provider.
Source§impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId
impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId
fn fingerprint_style() -> FingerprintStyle
Source§fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint
fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint
This method turns the parameters of a DepNodeConstructor into an opaque
Fingerprint to be used in DepNode.
Not all DepNodeParams support being turned into a Fingerprint (they
don’t need to if the corresponding DepNode is anonymous).
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String
Source§fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>
This method tries to recover the query key from the given
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it.Source§impl From<LocalDefId> for DefId
impl From<LocalDefId> for DefId
Source§fn from(local: LocalDefId) -> DefId
fn from(local: LocalDefId) -> DefId
Converts to this type from the input type.
Source§impl From<LocalModDefId> for DefId
impl From<LocalModDefId> for DefId
Source§fn from(typed: LocalModDefId) -> DefId
fn from(typed: LocalModDefId) -> DefId
Converts to this type from the input type.
Source§impl<CTX> HashStable<CTX> for DefIdwhere
CTX: HashStableContext,
impl<CTX> HashStable<CTX> for DefIdwhere
CTX: HashStableContext,
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)
Source§impl Key for DefId
impl Key for DefId
Source§type Cache<V> = DefIdCache<V>
type Cache<V> = DefIdCache<V>
The type of in-memory cache to use for queries with this key type. Read more
Source§fn default_span(&self, tcx: TyCtxt<'_>) -> Span
fn default_span(&self, tcx: TyCtxt<'_>) -> Span
In the event that a cycle occurs, if no explicit span has been
given for a query with key
self
, what span should we use?Source§fn key_as_def_id(&self) -> Option<DefId>
fn key_as_def_id(&self) -> Option<DefId>
Source§fn def_id_for_ty_in_cycle(&self) -> Option<DefId>
fn def_id_for_ty_in_cycle(&self) -> Option<DefId>
Used to detect when ADT def ids are used as keys in a cycle for better error reporting.