Type Alias Key

Source
pub type Key<'tcx> = CrateNum;

Aliased Type§

struct Key<'tcx> { /* private fields */ }

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: 4 bytes

Implementations

Source§

impl CrateNum

Source

pub const MAX_AS_U32: u32 = 4_294_967_040u32

Maximum value the index can take, as a u32.

Source

pub const MAX: CrateNum

Maximum value the index can take.

Source

pub const ZERO: CrateNum

Zero value of the index.

Source

pub const fn from_usize(value: usize) -> CrateNum

Creates a new index from a given usize.

§Panics

Will panic if value exceeds MAX.

Source

pub const fn from_u32(value: u32) -> CrateNum

Creates a new index from a given u32.

§Panics

Will panic if value exceeds MAX.

Source

pub const fn from_u16(value: u16) -> CrateNum

Creates a new index from a given u16.

§Panics

Will panic if value exceeds MAX.

Source

pub const unsafe fn from_u32_unchecked(value: u32) -> CrateNum

Creates a new index from a given u32.

§Safety

The provided value must be less than or equal to the maximum value for the newtype. Providing a value outside this range is undefined due to layout restrictions.

Prefer using from_u32.

Source

pub const fn index(self) -> usize

Extracts the value of this index as a usize.

Source

pub const fn as_u32(self) -> u32

Extracts the value of this index as a u32.

Source

pub const fn as_usize(self) -> usize

Extracts the value of this index as a usize.

Source§

impl CrateNum

Source

pub fn new(x: usize) -> CrateNum

Source

pub fn as_def_id(self) -> DefId

Source

pub fn as_mod_def_id(self) -> ModDefId

Trait Implementations

Source§

impl Add<usize> for CrateNum

Source§

type Output = CrateNum

The resulting type after applying the + operator.
Source§

fn add(self, other: usize) -> CrateNum

Performs the + operation. Read more
Source§

impl AsLocalKey for CrateNum

Source§

type LocalKey = LocalCrate

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 CrateNum

Source§

fn clone(&self) -> CrateNum

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 CrateNum

Source§

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

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

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

Source§

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

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 Display for CrateNum

Source§

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

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

impl<E> Encodable<E> for CrateNum
where E: SpanEncoder,

Source§

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

Source§

impl EraseType for CrateNum

Source§

type Result = [u8; 4]

Source§

impl From<u32> for CrateNum

Source§

fn from(value: u32) -> CrateNum

Converts to this type from the input type.
Source§

impl From<usize> for CrateNum

Source§

fn from(value: usize) -> CrateNum

Converts to this type from the input type.
Source§

impl Hash for CrateNum

Source§

fn hash<__H>(&self, state: &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 CrateNum
where CTX: HashStableContext,

Source§

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

Source§

impl Idx for CrateNum

Source§

fn new(value: usize) -> CrateNum

Source§

fn index(self) -> usize

Source§

fn increment_by(&mut self, amount: usize)

Source§

fn plus(self, amount: usize) -> Self

Source§

impl Key for CrateNum

Source§

type Cache<V> = VecCache<CrateNum, V, DepNodeIndex>

The type of in-memory cache to use for queries with this key type. Read more
Source§

fn default_span(&self, _: 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 Ord for CrateNum

Source§

fn cmp(&self, other: &CrateNum) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for CrateNum

Source§

fn eq(&self, other: &CrateNum) -> 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 PartialOrd for CrateNum

Source§

fn partial_cmp(&self, other: &CrateNum) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Step for CrateNum

Source§

fn steps_between(start: &CrateNum, end: &CrateNum) -> (usize, Option<usize>)

🔬This is a nightly-only experimental API. (step_trait)
Returns the bounds on the number of successor steps required to get from start to end like Iterator::size_hint(). Read more
Source§

fn forward_checked(start: CrateNum, u: usize) -> Option<CrateNum>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
Source§

fn backward_checked(start: CrateNum, u: usize) -> Option<CrateNum>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
Source§

fn forward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
Source§

unsafe fn forward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
Source§

fn backward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
Source§

unsafe fn backward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
Source§

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

Source§

impl Copy for CrateNum

Source§

impl Eq for CrateNum

Source§

impl StructuralPartialEq for CrateNum