pub struct StableHashState<'a> {
untracked: &'a Untracked,
incremental_ignore_spans: bool,
caching_source_map: CachingSourceMap<'a>,
stable_hash_controls: StableHashControls,
}Expand description
This is the context state available during incr. comp. hashing. It contains
enough information to transform DefIds and HirIds into stable DefPaths (i.e.,
a reference to the TyCtxt) and it holds a few caches for speeding up various
things (e.g., each DefId/DefPath is only hashed once).
Fields§
§untracked: &'a Untracked§incremental_ignore_spans: bool§caching_source_map: CachingSourceMap<'a>§stable_hash_controls: StableHashControlsImplementations§
Source§impl<'a> StableHashState<'a>
impl<'a> StableHashState<'a>
pub fn new(sess: &'a Session, untracked: &'a Untracked) -> Self
pub fn while_hashing_spans<F: FnOnce(&mut Self)>( &mut self, hash_spans: bool, f: F, )
fn source_map(&mut self) -> &mut CachingSourceMapView<'a>
fn def_span(&self, def_id: LocalDefId) -> Span
pub fn stable_hash_controls(&self) -> StableHashControls
Trait Implementations§
Source§impl<'a> StableHashCtxt for StableHashState<'a>
impl<'a> StableHashCtxt for StableHashState<'a>
Source§fn stable_hash_span(&mut self, raw_span: RawSpan, hasher: &mut StableHasher)
fn stable_hash_span(&mut self, raw_span: RawSpan, hasher: &mut StableHasher)
Hashes a span in a stable way. We can’t directly hash the span’s BytePos fields (that
would be similar to hashing pointers, since those are just offsets into the SourceMap).
Instead, we hash the (file name, line, column) triple, which stays the same even if the
containing SourceFile has moved within the SourceMap.
Also note that we are hashing byte offsets for the column, not unicode codepoint offsets. For the purpose of the hash that’s sufficient. Also, hashing filenames is expensive so we avoid doing it twice when the span starts and ends in the same file, which is almost always the case.
IMPORTANT: changes to this method should be reflected in implementations of SpanEncoder.
Source§fn assert_default_stable_hash_controls(&self, msg: &str)
fn assert_default_stable_hash_controls(&self, msg: &str)
Assert that the provided StableHashCtxt is configured with the default
StableHashControls. We should always have bailed out before getting to here with a
non-default mode. With this check in place, we can avoid the need to maintain separate
versions of ExpnData hashes for each permutation of StableHashControls settings.
Source§fn def_path_hash(&self, raw_def_id: RawDefId) -> RawDefPathHash
fn def_path_hash(&self, raw_def_id: RawDefId) -> RawDefPathHash
DefPathHash.Source§fn stable_hash_controls(&self) -> StableHashControls
fn stable_hash_controls(&self) -> StableHashControls
Auto Trait Implementations§
impl<'a> DynSend for StableHashState<'a>
impl<'a> DynSync for StableHashState<'a>
impl<'a> Freeze for StableHashState<'a>
impl<'a> !RefUnwindSafe for StableHashState<'a>
impl<'a> !Send for StableHashState<'a>
impl<'a> !Sync for StableHashState<'a>
impl<'a> Unpin for StableHashState<'a>
impl<'a> UnsafeUnpin for StableHashState<'a>
impl<'a> !UnwindSafe for StableHashState<'a>
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, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
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<K> IntoQueryKey<K> for K
impl<K> IntoQueryKey<K> for K
Source§fn into_query_key(self) -> K
fn into_query_key(self) -> K
Self to K.
This should always be a very cheap conversion, e.g. LocalDefId::to_def_id.Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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<T> ErasedDestructor for Twhere
T: 'static,
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: 48 bytes