Struct rustc_middle::ty::TyS
source · pub(crate) struct TyS<'tcx> {
kind: TyKind<'tcx>,
flags: TypeFlags,
outer_exclusive_binder: DebruijnIndex,
}
Expand description
Represents a type.
IMPORTANT:
- This is a very “dumb” struct (with no derives and no
impls
). - Values of this type are always interned and thus unique, and are stored
as an
Interned<TyS>
. Ty
(which contains a reference to aInterned<TyS>
) orInterned<TyS>
should be used everywhere instead ofTyS
. In particular,Ty
has most of the relevant methods.
Fields
kind: TyKind<'tcx>
This field shouldn’t be used directly and may be removed in the future.
Use Ty::kind()
instead.
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
sourceimpl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TyS<'tcx>
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TyS<'tcx>
fn hash_stable(
&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher
)
sourceimpl<'tcx> Ord for TyS<'tcx>
impl<'tcx> Ord for TyS<'tcx>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl<'tcx> PartialOrd<TyS<'tcx>> for TyS<'tcx>
impl<'tcx> PartialOrd<TyS<'tcx>> for TyS<'tcx>
sourcefn partial_cmp(&self, other: &TyS<'tcx>) -> Option<Ordering>
fn partial_cmp(&self, other: &TyS<'tcx>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<'tcx> Eq for TyS<'tcx>
impl<'tcx> StructuralEq for TyS<'tcx>
impl<'tcx> StructuralPartialEq for TyS<'tcx>
Auto Trait Implementations
impl<'tcx> !RefUnwindSafe for TyS<'tcx>
impl<'tcx> Send for TyS<'tcx>
impl<'tcx> Sync for TyS<'tcx>
impl<'tcx> Unpin for TyS<'tcx>
impl<'tcx> !UnwindSafe for TyS<'tcx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
sourceimpl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
sourceimpl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
impl<CTX, T> Value<CTX> for Twhere
CTX: DepContext,
default fn from_cycle_error(tcx: CTX) -> T
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: 40 bytes