pub enum CastKind {
PointerExposeProvenance,
PointerWithExposedProvenance,
PointerCoercion(PointerCoercion, CoercionSource),
IntToInt,
FloatToInt,
FloatToFloat,
IntToFloat,
PtrToPtr,
FnPtrToPtr,
Transmute,
}Variants§
PointerExposeProvenance
An exposing pointer to address cast. A cast between a pointer and an integer type, or
between a function pointer and an integer type.
See the docs on expose_provenance for more details.
PointerWithExposedProvenance
An address-to-pointer cast that picks up an exposed provenance.
See the docs on with_exposed_provenance for more details.
PointerCoercion(PointerCoercion, CoercionSource)
Pointer related casts that are done by coercions. Note that reference-to-raw-ptr casts are
translated into &raw mut/const *r, i.e., they are not actually casts.
The following are allowed in AnalysisPhase::Initial as they’re needed for borrowck,
but after that are forbidden (including in all phases of runtime MIR):
Both are runtime nops, so should be CastKind::PtrToPtr instead in runtime MIR.
IntToInt
FloatToInt
FloatToFloat
IntToFloat
PtrToPtr
FnPtrToPtr
Transmute
Reinterpret the bits of the input as a different type.
MIR is well-formed if the input and output types have different sizes, but running a transmute between differently-sized types is UB.
Allowed only in MirPhase::Runtime; Earlier it’s a TerminatorKind::Call.
Auto Trait Implementations§
impl Freeze for CastKind
impl RefUnwindSafe for CastKind
impl Send for CastKind
impl Sync for CastKind
impl Unpin for CastKind
impl UnwindSafe for CastKind
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.