Struct rustc_span::StableSourceFileId
source · pub struct StableSourceFileId(pub(crate) Hash128);Expand description
This is a SourceFile identifier that is used to correlate source files between subsequent compilation sessions (which is something we need to do during incremental compilation).
It is a hash value (so we can efficiently consume it when stable-hashing
spans) that consists of the FileName and the StableCrateId of the crate
the source file is from. The crate id is needed because sometimes the
FileName is not unique within the crate graph (think src/lib.rs, for
example).
The way the crate-id part is handled is a bit special: source files of the
local crate are hashed as (filename, None), while source files from
upstream crates have a hash of (filename, Some(stable_crate_id)). This
is because SourceFiles for the local crate are allocated very early in the
compilation process when the StableCrateId is not yet known. If, due to
some refactoring of the compiler, the StableCrateId of the local crate
were to become available, it would be better to uniformely make this a
hash of (filename, stable_crate_id).
When SourceFiles are exported in crate metadata, the StableSourceFileId
is updated to incorporate the StableCrateId of the exporting crate.
Tuple Fields§
§0: Hash128Implementations§
source§impl StableSourceFileId
impl StableSourceFileId
pub(crate) fn from_filename_in_current_crate(filename: &FileName) -> Self
pub fn from_filename_for_export( filename: &FileName, local_crate_stable_crate_id: StableCrateId, ) -> Self
pub(crate) fn from_filename_and_stable_crate_id( filename: &FileName, stable_crate_id: Option<StableCrateId>, ) -> Self
Trait Implementations§
source§impl Clone for StableSourceFileId
impl Clone for StableSourceFileId
source§fn clone(&self) -> StableSourceFileId
fn clone(&self) -> StableSourceFileId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for StableSourceFileId
impl Debug for StableSourceFileId
source§impl<__D: SpanDecoder> Decodable<__D> for StableSourceFileId
impl<__D: SpanDecoder> Decodable<__D> for StableSourceFileId
source§impl Default for StableSourceFileId
impl Default for StableSourceFileId
source§fn default() -> StableSourceFileId
fn default() -> StableSourceFileId
source§impl<__E: SpanEncoder> Encodable<__E> for StableSourceFileId
impl<__E: SpanEncoder> Encodable<__E> for StableSourceFileId
source§impl Hash for StableSourceFileId
impl Hash for StableSourceFileId
source§impl<__CTX> HashStable<__CTX> for StableSourceFileIdwhere
__CTX: HashStableContext,
impl<__CTX> HashStable<__CTX> for StableSourceFileIdwhere
__CTX: HashStableContext,
fn hash_stable(&self, __hcx: &mut __CTX, __hasher: &mut StableHasher)
source§impl Ord for StableSourceFileId
impl Ord for StableSourceFileId
source§fn cmp(&self, other: &StableSourceFileId) -> Ordering
fn cmp(&self, other: &StableSourceFileId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for StableSourceFileId
impl PartialEq for StableSourceFileId
source§fn eq(&self, other: &StableSourceFileId) -> bool
fn eq(&self, other: &StableSourceFileId) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd for StableSourceFileId
impl PartialOrd for StableSourceFileId
source§fn partial_cmp(&self, other: &StableSourceFileId) -> Option<Ordering>
fn partial_cmp(&self, other: &StableSourceFileId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Copy for StableSourceFileId
impl Eq for StableSourceFileId
impl StructuralPartialEq for StableSourceFileId
Auto Trait Implementations§
impl DynSend for StableSourceFileId
impl DynSync for StableSourceFileId
impl Freeze for StableSourceFileId
impl RefUnwindSafe for StableSourceFileId
impl Send for StableSourceFileId
impl Sync for StableSourceFileId
impl Unpin for StableSourceFileId
impl UnwindSafe for StableSourceFileId
Blanket Implementations§
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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<T> Pointable for T
impl<T> Pointable for 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,
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: 16 bytes