about summary refs log tree commit diff
path: root/src/test/ui/allocator
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-05 11:40:10 +0900
committerGitHub <noreply@github.com>2020-08-05 11:40:10 +0900
commit5f87ee0ab1bcbf708d27e928296cb44ce9ba9c5f (patch)
tree083a7688350f0954df58f645179b23f0ee033f64 /src/test/ui/allocator
parent7123daff5359dc3ebabcf4d1e00b085c27455877 (diff)
parent93d98328d161bcdf002f9d2f7f916f01c6fce3b1 (diff)
downloadrust-5f87ee0ab1bcbf708d27e928296cb44ce9ba9c5f.tar.gz
rust-5f87ee0ab1bcbf708d27e928296cb44ce9ba9c5f.zip
Rollup merge of #75152 - TimDiekmann:replace_memblock, r=Amanieu
Replace `Memoryblock` with `NonNull<[u8]>`

Closes rust-lang/wg-allocators#61

r? @Amanieu
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);
     }
 }