From 4aef81eb85a47ff123db8204c59c610fa28f8693 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 27 Dec 2019 14:26:05 +0100 Subject: [PATCH] Remove `to_ptr` uses --- rust-version | 2 +- src/shims/foreign_items.rs | 2 +- src/shims/intrinsics.rs | 2 +- src/stacked_borrows.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust-version b/rust-version index 999e8b0f8f7..b8bd5f9e574 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -9ae6cedb8d1e37469be1434642a3e403fce50a03 +8f5f8f916f00f7989a4ebf7b7dbfe1afd605f828 diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 51c43b28b68..5bdd12b4eb1 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -271,7 +271,6 @@ fn emulate_foreign_item( )?; } "__rust_realloc" => { - let ptr = this.read_scalar(args[0])?.to_ptr()?; let old_size = this.read_scalar(args[1])?.to_machine_usize(this)?; let align = this.read_scalar(args[2])?.to_machine_usize(this)?; let new_size = this.read_scalar(args[3])?.to_machine_usize(this)?; @@ -281,6 +280,7 @@ fn emulate_foreign_item( if !align.is_power_of_two() { throw_unsup!(HeapAllocNonPowerOfTwoAlignment(align)); } + let ptr = this.force_ptr(this.read_scalar(args[0])?.not_undef()?)?; let align = Align::from_bytes(align).unwrap(); let new_ptr = this.memory.reallocate( ptr, diff --git a/src/shims/intrinsics.rs b/src/shims/intrinsics.rs index bde2dd4655b..37aee1f5652 100644 --- a/src/shims/intrinsics.rs +++ b/src/shims/intrinsics.rs @@ -575,7 +575,7 @@ fn call_intrinsic( // Do it in memory let mplace = this.force_allocation(dest)?; mplace.meta.unwrap_none(); - let ptr = mplace.ptr.to_ptr()?; + let ptr = mplace.ptr.assert_ptr(); // We know the return place is in-bounds this.memory.get_raw_mut(ptr.alloc_id)?.mark_definedness( ptr, diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index d986a2db538..18edb603c6c 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -507,7 +507,7 @@ fn reborrow( ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); let protector = if protect { Some(this.frame().extra.call_id) } else { None }; - let ptr = place.ptr.to_ptr().expect("we should have a proper pointer"); + let ptr = place.ptr.assert_ptr(); trace!( "reborrow: {} reference {:?} derived from {:?} (pointee {}): {:?}, size {}", kind, -- 2.44.0