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§
source§impl<I: Interner<InferTy = InferTy>> DebugWithInfcx<I> for InferTy
impl<I: Interner<InferTy = InferTy>> DebugWithInfcx<I> for InferTy
fn fmt<InfCtx: InferCtxtLike<I>>( this: OptWithInfcx<'_, I, InfCtx, &Self>, f: &mut Formatter<'_> ) -> Result
source§impl<CTX> HashStable<CTX> for InferTy
impl<CTX> HashStable<CTX> for InferTy
fn hash_stable(&self, ctx: &mut CTX, hasher: &mut StableHasher)
source§impl Ord for InferTy
impl Ord for InferTy
source§impl PartialEq<InferTy> for InferTy
impl PartialEq<InferTy> for InferTy
source§impl PartialOrd<InferTy> for InferTy
impl PartialOrd<InferTy> for InferTy
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 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§
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: 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