Skip to content

Commit 666bebc

Browse files
committed
Change to_ptr by force_ptr
1 parent 67f6ac4 commit 666bebc

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/librustc_mir/interpret/memory.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
632632
if size.bytes() == 0 {
633633
Ok(&[])
634634
} else {
635-
let ptr = ptr.to_ptr()?;
635+
let ptr = self.force_ptr(ptr)?;
636636
self.get(ptr.alloc_id)?.get_bytes(self, ptr, size)
637637
}
638638
}
@@ -719,8 +719,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> {
719719
// non-NULLness which already happened.
720720
return Ok(());
721721
}
722-
let src = src.to_ptr()?;
723-
let dest = dest.to_ptr()?;
722+
let src = self.force_ptr(src)?;
723+
let dest = self.force_ptr(dest)?;
724724

725725
// first copy the relocations to a temporary buffer, because
726726
// `get_bytes_mut` will clear the relocations, which is correct,

src/librustc_mir/interpret/operand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
232232
}
233233

234234
// check for integer pointers before alignment to report better errors
235-
let ptr = ptr.to_ptr()?;
235+
let ptr = self.force_ptr(ptr)?;
236236
self.memory.check_align(ptr.into(), ptr_align)?;
237237
match mplace.layout.abi {
238238
layout::Abi::Scalar(..) => {

src/librustc_mir/interpret/place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ where
750750
}
751751

752752
// check for integer pointers before alignment to report better errors
753-
let ptr = ptr.to_ptr()?;
753+
let ptr = self.force_ptr(ptr)?;
754754
self.memory.check_align(ptr.into(), ptr_align)?;
755755
let tcx = &*self.tcx;
756756
// FIXME: We should check that there are dest.layout.size many bytes available in

src/librustc_mir/interpret/terminator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
7979
let (fn_def, abi) = match func.layout.ty.sty {
8080
ty::FnPtr(sig) => {
8181
let caller_abi = sig.abi();
82-
let fn_ptr = self.read_scalar(func)?.to_ptr()?;
82+
let fn_ptr = self.force_ptr(self.read_scalar(func)?.not_undef()?)?;
8383
let instance = self.memory.get_fn(fn_ptr)?;
8484
(instance, caller_abi)
8585
}

src/librustc_mir/interpret/validity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
559559
// This is the size in bytes of the whole array.
560560
let size = ty_size * len;
561561

562-
let ptr = mplace.ptr.to_ptr()?;
562+
let ptr = self.ecx.force_ptr(mplace.ptr)?;
563563

564564
// NOTE: Keep this in sync with the handling of integer and float
565565
// types above, in `visit_primitive`.

0 commit comments

Comments
 (0)