Enum rustc_const_eval::interpret::Immediate
source · [−]pub enum Immediate<Tag: Provenance = AllocId> {
Scalar(ScalarMaybeUninit<Tag>),
ScalarPair(ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>),
}
Expand description
An Immediate
represents a single immediate self-contained Rust value.
For optimization of a few very common cases, there is also a representation for a pair of
primitive values (ScalarPair
). It allows Miri to avoid making allocations for checked binary
operations and wide pointers. This idea was taken from rustc’s codegen.
In particular, thanks to ScalarPair
, arithmetic operations and casts can be entirely
defined on Immediate
, and do not have to work with a Place
.
Variants
Scalar(ScalarMaybeUninit<Tag>)
ScalarPair(ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>)
Implementations
sourceimpl<'tcx, Tag: Provenance> Immediate<Tag>
impl<'tcx, Tag: Provenance> Immediate<Tag>
pub fn from_pointer(p: Pointer<Tag>, cx: &impl HasDataLayout) -> Self
pub fn from_maybe_pointer(
p: Pointer<Option<Tag>>,
cx: &impl HasDataLayout
) -> Self
pub fn new_slice(val: Scalar<Tag>, len: u64, cx: &impl HasDataLayout) -> Self
pub fn new_dyn_trait(
val: Scalar<Tag>,
vtable: Pointer<Option<Tag>>,
cx: &impl HasDataLayout
) -> Self
pub fn to_scalar_or_uninit(self) -> ScalarMaybeUninit<Tag>
pub fn to_scalar(self) -> InterpResult<'tcx, Scalar<Tag>>
pub fn to_scalar_or_uninit_pair(
self
) -> (ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>)
pub fn to_scalar_pair(self) -> InterpResult<'tcx, (Scalar<Tag>, Scalar<Tag>)>
Trait Implementations
sourceimpl<Tag: Clone + Provenance> Clone for Immediate<Tag>
impl<Tag: Clone + Provenance> Clone for Immediate<Tag>
sourceimpl<Tag: Debug + Provenance> Debug for Immediate<Tag>
impl<Tag: Debug + Provenance> Debug for Immediate<Tag>
sourceimpl<Tag: Provenance> From<Scalar<Tag>> for Immediate<Tag>
impl<Tag: Provenance> From<Scalar<Tag>> for Immediate<Tag>
sourceimpl<Tag: Provenance> From<ScalarMaybeUninit<Tag>> for Immediate<Tag>
impl<Tag: Provenance> From<ScalarMaybeUninit<Tag>> for Immediate<Tag>
sourcefn from(val: ScalarMaybeUninit<Tag>) -> Self
fn from(val: ScalarMaybeUninit<Tag>) -> Self
Converts to this type from the input type.
sourceimpl<Tag: Hash + Provenance> Hash for Immediate<Tag>
impl<Tag: Hash + Provenance> Hash for Immediate<Tag>
sourceimpl<'__ctx, Tag: Provenance> HashStable<StableHashingContext<'__ctx>> for Immediate<Tag> where
Tag: HashStable<StableHashingContext<'__ctx>>,
impl<'__ctx, Tag: Provenance> HashStable<StableHashingContext<'__ctx>> for Immediate<Tag> where
Tag: HashStable<StableHashingContext<'__ctx>>,
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
impl<Tag: Copy + Provenance> Copy for Immediate<Tag>
impl<Tag: Eq + Provenance> Eq for Immediate<Tag>
impl<Tag: Provenance> StructuralEq for Immediate<Tag>
impl<Tag: Provenance> StructuralPartialEq for Immediate<Tag>
Auto Trait Implementations
impl<Tag> RefUnwindSafe for Immediate<Tag> where
Tag: RefUnwindSafe,
impl<Tag> Send for Immediate<Tag> where
Tag: Send,
impl<Tag> Sync for Immediate<Tag> where
Tag: Sync,
impl<Tag> Unpin for Immediate<Tag> where
Tag: Unpin,
impl<Tag> UnwindSafe for Immediate<Tag> where
Tag: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
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.