]> git.lizzy.rs Git - rust.git/commitdiff
Remove `to_ptr` uses
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 27 Dec 2019 13:26:05 +0000 (14:26 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Fri, 27 Dec 2019 13:26:05 +0000 (14:26 +0100)
rust-version
src/shims/foreign_items.rs
src/shims/intrinsics.rs
src/stacked_borrows.rs

index 999e8b0f8f730eb46b4e38d653883b355068cb51..b8bd5f9e57449e0d24847617bf3a045a324743b6 100644 (file)
@@ -1 +1 @@
-9ae6cedb8d1e37469be1434642a3e403fce50a03
+8f5f8f916f00f7989a4ebf7b7dbfe1afd605f828
index 51c43b28b68aaa324c6223f6b140c43b44b78acb..5bdd12b4eb1d264eccad6416062344987608c9aa 100644 (file)
@@ -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,
index bde2dd4655bf7c852a66a2e0f4efae9635221b5b..37aee1f5652c1a9c7e80694b3f1362937c995822 100644 (file)
@@ -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,
index d986a2db53837a48bf54e251486541dc1e804ec5..18edb603c6cf1ffcc3be91ae2ca7a11cf5bc43b6 100644 (file)
@@ -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,