Skip to content

Commit 34d8ec8

Browse files
committed
Auto merge of #1114 - rust-lang:to_ptr_considered_harmful, r=oli-obk
Remove all uses of `to_ptr` Also only works on top of rust-lang/rust#67192
2 parents 0f1dec0 + 4aef81e commit 34d8ec8

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9ae6cedb8d1e37469be1434642a3e403fce50a03
1+
8f5f8f916f00f7989a4ebf7b7dbfe1afd605f828

src/shims/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
271271
)?;
272272
}
273273
"__rust_realloc" => {
274-
let ptr = this.read_scalar(args[0])?.to_ptr()?;
275274
let old_size = this.read_scalar(args[1])?.to_machine_usize(this)?;
276275
let align = this.read_scalar(args[2])?.to_machine_usize(this)?;
277276
let new_size = this.read_scalar(args[3])?.to_machine_usize(this)?;
@@ -281,6 +280,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
281280
if !align.is_power_of_two() {
282281
throw_unsup!(HeapAllocNonPowerOfTwoAlignment(align));
283282
}
283+
let ptr = this.force_ptr(this.read_scalar(args[0])?.not_undef()?)?;
284284
let align = Align::from_bytes(align).unwrap();
285285
let new_ptr = this.memory.reallocate(
286286
ptr,

src/shims/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
575575
// Do it in memory
576576
let mplace = this.force_allocation(dest)?;
577577
mplace.meta.unwrap_none();
578-
let ptr = mplace.ptr.to_ptr()?;
578+
let ptr = mplace.ptr.assert_ptr();
579579
// We know the return place is in-bounds
580580
this.memory.get_raw_mut(ptr.alloc_id)?.mark_definedness(
581581
ptr,

src/stacked_borrows.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
507507
) -> InterpResult<'tcx> {
508508
let this = self.eval_context_mut();
509509
let protector = if protect { Some(this.frame().extra.call_id) } else { None };
510-
let ptr = place.ptr.to_ptr().expect("we should have a proper pointer");
510+
let ptr = place.ptr.assert_ptr();
511511
trace!(
512512
"reborrow: {} reference {:?} derived from {:?} (pointee {}): {:?}, size {}",
513513
kind,

0 commit comments

Comments
 (0)