Type Alias Key

Source
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

Source

pub fn local(index: DefIndex) -> DefId

Makes a local DefId from the given DefIndex.

Source

pub fn is_local(self) -> bool

Returns whether the item is defined in the crate currently being compiled.

Source

pub fn as_local(self) -> Option<LocalDefId>

Source

pub fn expect_local(self) -> LocalDefId

Source

pub fn is_crate_root(self) -> bool

Source

pub fn as_crate_root(self) -> Option<CrateNum>

Source

pub fn is_top_level_module(self) -> bool

Trait Implementations

Source§

impl AsLocalKey for DefId

Source§

type LocalKey = LocalDefId

Source§

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 Clone for DefId

Source§

fn clone(&self) -> DefId

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DefId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<D> Decodable<D> for DefId
where D: SpanDecoder,

Source§

impl<'tcx> DefId<TyCtxt<'tcx>> for DefId

Source§

impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId

Source§

fn fingerprint_style() -> FingerprintStyle

Source§

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).
Source§

fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String

Source§

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 DepNodes 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<E> Encodable<E> for DefId
where E: SpanEncoder,

Source§

fn encode(&self, s: &mut E)

Source§

impl EraseType for DefId

Source§

type Result = [u8; 8]

Source§

impl From<LocalDefId> for DefId

Source§

fn from(local: LocalDefId) -> DefId

Converts to this type from the input type.
Source§

impl From<LocalModDefId> for DefId

Source§

fn from(typed: LocalModDefId) -> DefId

Converts to this type from the input type.
Source§

impl From<ModDefId> for DefId

Source§

fn from(typed: ModDefId) -> DefId

Converts to this type from the input type.
Source§

impl From<OwnerId> for DefId

Source§

fn from(value: OwnerId) -> DefId

Converts to this type from the input type.
Source§

impl Hash for DefId

Source§

fn hash<H>(&self, h: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<CTX> HashStable<CTX> for DefId
where CTX: HashStableContext,

Source§

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)

Source§

impl Key for DefId

Source§

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

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>

If the key is a DefId or DefId–equivalent, return that DefId. Otherwise, return None.
Source§

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.
Source§

impl<'tcx> Lift<TyCtxt<'tcx>> for DefId

Source§

type Lifted = DefId

Source§

fn lift_to_interner(self, _: TyCtxt<'tcx>) -> Option<Self>

Source§

impl ParameterizedOverTcx for DefId

Source§

type Value<'tcx> = DefId

Source§

impl PartialEq for DefId

Source§

fn eq(&self, other: &DefId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D> for DefId

Source§

fn decode(decoder: &mut D) -> &'tcx Self

Source§

impl<CTX> ToStableHashKey<CTX> for DefId
where CTX: HashStableContext,

Source§

impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for DefId

Source§

fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( self, _: &mut F, ) -> Result<Self, F::Error>

The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
Source§

fn fold_with<F: TypeFolder<TyCtxt<'tcx>>>(self, _: &mut F) -> Self

A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with.
Source§

impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for DefId

Source§

fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result

The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
Source§

impl Copy for DefId

Source§

impl Eq for DefId

Source§

impl !Ord for DefId

Source§

impl !PartialOrd for DefId

Source§

impl StructuralPartialEq for DefId