Struct rustc_middle::ty::WithCachedTypeInfo
source · pub struct WithCachedTypeInfo<T> {
pub internee: T,
pub stable_hash: Fingerprint,
pub flags: TypeFlags,
pub outer_exclusive_binder: DebruijnIndex,
}Expand description
A helper type that you can wrap round your own type in order to automatically cache the stable hash, type flags and debruijn index on creation and not recompute it whenever the information is needed. This is only done in incremental mode. You can also opt out of caching by using StableHash::ZERO for the hash, in which case the hash gets computed each time. This is useful if you have values that you intern but never (can?) use for stable hashing.
Fields§
§internee: T§stable_hash: Fingerprint§flags: TypeFlagsThis field provides fast access to information that is also contained
in kind.
This field shouldn’t be used directly and may be removed in the future.
Use Ty::flags() instead.
outer_exclusive_binder: DebruijnIndexThis field provides fast access to information that is also contained
in kind.
This is a kind of confusing thing: it stores the smallest binder such that
(a) the binder itself captures nothing but (b) all the late-bound things within the type are captured by some sub-binder.
So, for a type without any late-bound things, like u32, this
will be innermost, because that is the innermost binder that
captures nothing. But for a type &'D u32, where 'D is a
late-bound region with De Bruijn index D, this would be D + 1
– the binder itself does not capture D, but D is captured
by an inner binder.
We call this concept an “exclusive” binder D because all
De Bruijn indices within the type are contained within 0..D
(exclusive).
Trait Implementations§
source§impl<T> Clone for WithCachedTypeInfo<T>where
T: Clone,
impl<T> Clone for WithCachedTypeInfo<T>where
T: Clone,
source§fn clone(&self) -> WithCachedTypeInfo<T>
fn clone(&self) -> WithCachedTypeInfo<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T> Deref for WithCachedTypeInfo<T>
impl<T> Deref for WithCachedTypeInfo<T>
source§impl<T> Hash for WithCachedTypeInfo<T>where
T: Hash,
impl<T> Hash for WithCachedTypeInfo<T>where
T: Hash,
source§impl<T, CTX> HashStable<CTX> for WithCachedTypeInfo<T>where
T: HashStable<CTX>,
impl<T, CTX> HashStable<CTX> for WithCachedTypeInfo<T>where
T: HashStable<CTX>,
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)
source§impl<T> Ord for WithCachedTypeInfo<T>where
T: Ord,
impl<T> Ord for WithCachedTypeInfo<T>where
T: Ord,
source§fn cmp(&self, other: &WithCachedTypeInfo<T>) -> Ordering
fn cmp(&self, other: &WithCachedTypeInfo<T>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<T> PartialEq for WithCachedTypeInfo<T>where
T: PartialEq,
impl<T> PartialEq for WithCachedTypeInfo<T>where
T: PartialEq,
source§fn eq(&self, other: &WithCachedTypeInfo<T>) -> bool
fn eq(&self, other: &WithCachedTypeInfo<T>) -> bool
self and other values to be equal, and is used
by ==.source§impl<T> PartialOrd for WithCachedTypeInfo<T>where
T: Ord,
impl<T> PartialOrd for WithCachedTypeInfo<T>where
T: Ord,
source§fn partial_cmp(&self, other: &WithCachedTypeInfo<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &WithCachedTypeInfo<T>) -> 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<T> Copy for WithCachedTypeInfo<T>where
T: Copy,
impl<T> Eq for WithCachedTypeInfo<T>where
T: Eq,
Auto Trait Implementations§
impl<T> DynSend for WithCachedTypeInfo<T>where
T: DynSend,
impl<T> DynSync for WithCachedTypeInfo<T>where
T: DynSync,
impl<T> Freeze for WithCachedTypeInfo<T>where
T: Freeze,
impl<T> RefUnwindSafe for WithCachedTypeInfo<T>where
T: RefUnwindSafe,
impl<T> Send for WithCachedTypeInfo<T>where
T: Send,
impl<T> Sync for WithCachedTypeInfo<T>where
T: Sync,
impl<T> Unpin for WithCachedTypeInfo<T>where
T: Unpin,
impl<T> UnwindSafe for WithCachedTypeInfo<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'a mut [T]
source§impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
impl<'tcx, T> ArenaAllocatable<'tcx, IsCopy> for Twhere
T: Copy,
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut T
fn allocate_from_iter<'a>( arena: &'a Arena<'tcx>, iter: impl IntoIterator<Item = T>, ) -> &'a mut [T]
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<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
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> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
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<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> 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,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.