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 uniformly make this a
hash of (filename, stable_crate_id)
.
When SourceFile
s are exported in crate metadata, the StableSourceFileId
is updated to incorporate the StableCrateId
of the exporting crate.
Tuple Fields§
§0: Hash128
Implementations§
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§impl PartialOrd for StableSourceFileId
impl PartialOrd for StableSourceFileId
impl 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§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