Enum rustc_type_ir::InferTy
source · [−]pub enum InferTy {
TyVar(TyVid),
IntVar(IntVid),
FloatVar(FloatVid),
FreshTy(u32),
FreshIntTy(u32),
FreshFloatTy(u32),
}
Expand description
A placeholder for a type that hasn’t been inferred yet.
E.g., if we have an empty array ([]
), then we create a fresh
type variable for the element type since we won’t know until it’s
used what the element type is supposed to be.
Variants
TyVar(TyVid)
A type variable.
IntVar(IntVid)
An integral type variable ({integer}
).
These are created when the compiler sees an integer literal like
1
that could be several different types (u8
, i32
, u32
, etc.).
We don’t know until it’s used what type it’s supposed to be, so
we create a fresh type variable.
FloatVar(FloatVid)
A floating-point type variable ({float}
).
These are created when the compiler sees an float literal like
1.0
that could be either an f32
or an f64
.
We don’t know until it’s used what type it’s supposed to be, so
we create a fresh type variable.
FreshTy(u32)
A FreshTy
is one that is generated as a replacement
for an unbound type variable. This is convenient for caching etc. See
rustc_infer::infer::freshen
for more details.
Compare with TyVar
.
FreshIntTy(u32)
FreshFloatTy(u32)
Trait Implementations
sourceimpl<CTX> HashStable<CTX> for InferTy
impl<CTX> HashStable<CTX> for InferTy
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher)
sourceimpl Ord for InferTy
impl Ord for InferTy
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 PartialOrd<InferTy> for InferTy
impl PartialOrd<InferTy> for InferTy
sourcefn partial_cmp(&self, other: &InferTy) -> Option<Ordering>
fn partial_cmp(&self, other: &InferTy) -> 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 Copy for InferTy
impl Eq for InferTy
impl StructuralEq for InferTy
impl StructuralPartialEq for InferTy
Auto Trait Implementations
impl RefUnwindSafe for InferTy
impl Send for InferTy
impl Sync for InferTy
impl Unpin for InferTy
impl UnwindSafe for InferTy
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,
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: 8 bytes
Size for each variant:
TyVar
: 4 bytesIntVar
: 4 bytesFloatVar
: 4 bytesFreshTy
: 4 bytesFreshIntTy
: 4 bytesFreshFloatTy
: 4 bytes