about summary refs log tree commit diff
path: root/src/test/ui/allocator
diff options
context:
space:
mode:
authorTim Diekmann <tim.diekmann@3dvision.de>2020-08-04 18:03:34 +0200
committerTim Diekmann <tim.diekmann@3dvision.de>2020-08-04 18:03:34 +0200
commitab9362ad9a9b4b93951ccb577224dda367923226 (patch)
tree4f340c1b48834529b0cd41ddba17a2b66f3379ee /src/test/ui/allocator
parent5f6bd6ec0ac422991b89bb8643eaa5d9d46eed11 (diff)
downloadrust-ab9362ad9a9b4b93951ccb577224dda367923226.tar.gz
rust-ab9362ad9a9b4b93951ccb577224dda367923226.zip
Replace `Memoryblock` with `NonNull<[u8]>`
Diffstat (limited to 'src/test/ui/allocator')
-rw-r--r--src/test/ui/allocator/custom.rs9
-rw-r--r--src/test/ui/allocator/xcrate-use.rs9
2 files changed, 10 insertions, 8 deletions
diff --git a/src/test/ui/allocator/custom.rs b/src/test/ui/allocator/custom.rs
index f10d29f33fc..a6c2317c736 100644
--- a/src/test/ui/allocator/custom.rs
+++ b/src/test/ui/allocator/custom.rs
@@ -4,6 +4,7 @@
 // no-prefer-dynamic
 
 #![feature(allocator_api)]
+#![feature(slice_ptr_get)]
 
 extern crate helper;
 
@@ -38,9 +39,9 @@ fn main() {
         let layout = Layout::from_size_align(4, 2).unwrap();
 
         let memory = Global.alloc(layout.clone()).unwrap();
-        helper::work_with(&memory.ptr);
+        helper::work_with(&memory);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 1);
-        Global.dealloc(memory.ptr, layout);
+        Global.dealloc(memory.as_non_null_ptr(), layout);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 2);
 
         let s = String::with_capacity(10);
@@ -51,8 +52,8 @@ fn main() {
 
         let memory = System.alloc(layout.clone()).unwrap();
         assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
-        helper::work_with(&memory.ptr);
-        System.dealloc(memory.ptr, layout);
+        helper::work_with(&memory);
+        System.dealloc(memory.as_non_null_ptr(), layout);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
     }
 }
diff --git a/src/test/ui/allocator/xcrate-use.rs b/src/test/ui/allocator/xcrate-use.rs
index c7d31f71074..a1446b3664d 100644
--- a/src/test/ui/allocator/xcrate-use.rs
+++ b/src/test/ui/allocator/xcrate-use.rs
@@ -5,6 +5,7 @@
 // no-prefer-dynamic
 
 #![feature(allocator_api)]
+#![feature(slice_ptr_get)]
 
 extern crate custom;
 extern crate helper;
@@ -21,15 +22,15 @@ fn main() {
         let layout = Layout::from_size_align(4, 2).unwrap();
 
         let memory = Global.alloc(layout.clone()).unwrap();
-        helper::work_with(&memory.ptr);
+        helper::work_with(&memory);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
-        Global.dealloc(memory.ptr, layout);
+        Global.dealloc(memory.as_non_null_ptr(), layout);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
 
         let memory = System.alloc(layout.clone()).unwrap();
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
-        helper::work_with(&memory.ptr);
-        System.dealloc(memory.ptr, layout);
+        helper::work_with(&memory);
+        System.dealloc(memory.as_non_null_ptr(), layout);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
     }
 }