Struct rustc_type_ir::ty_info::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: TypeFlags
This 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: DebruijnIndex
This 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> Clone for WithCachedTypeInfo<T>
impl<T: Clone> Clone for WithCachedTypeInfo<T>
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> Hash for WithCachedTypeInfo<T>
impl<T: Hash> Hash for WithCachedTypeInfo<T>
source§impl<T: HashStable<CTX>, CTX> HashStable<CTX> for WithCachedTypeInfo<T>
impl<T: HashStable<CTX>, CTX> HashStable<CTX> for WithCachedTypeInfo<T>
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)
source§impl<T: Ord> Ord for WithCachedTypeInfo<T>
impl<T: Ord> Ord for WithCachedTypeInfo<T>
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> PartialEq<WithCachedTypeInfo<T>> for WithCachedTypeInfo<T>
impl<T: PartialEq> PartialEq<WithCachedTypeInfo<T>> for WithCachedTypeInfo<T>
source§impl<T: Ord> PartialOrd<WithCachedTypeInfo<T>> for WithCachedTypeInfo<T>
impl<T: Ord> PartialOrd<WithCachedTypeInfo<T>> for WithCachedTypeInfo<T>
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> Copy for WithCachedTypeInfo<T>
impl<T: Eq> Eq for WithCachedTypeInfo<T>
Auto Trait Implementations§
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<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
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.