now we can make scalar_to_ptr a method on Scalar

This commit is contained in:
Ralf Jung 2022-07-23 10:36:57 -04:00
parent 665a7e8f56
commit 4e89a7c293
10 changed files with 41 additions and 45 deletions

View file

@ -14,7 +14,7 @@ use rustc_target::abi::{VariantIdx, Variants};
use super::{
alloc_range, from_known_layout, mir_assign_valid_types, AllocId, ConstValue, Frame, GlobalId,
InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Place, PlaceTy, Pointer,
PointerArithmetic, Provenance, Scalar, ScalarMaybeUninit,
Provenance, Scalar, ScalarMaybeUninit,
};
/// An `Immediate` represents a single immediate self-contained Rust value.
@ -455,7 +455,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
&self,
op: &OpTy<'tcx, M::Provenance>,
) -> InterpResult<'tcx, Pointer<Option<M::Provenance>>> {
self.scalar_to_ptr(self.read_scalar(op)?.check_init()?)
self.read_scalar(op)?.to_pointer(self)
}
/// Turn the wide MPlace into a string (must already be dereferenced!)