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-12-04 14:47:15 +0100
committerTim Diekmann <tim.diekmann@3dvision.de>2020-12-04 14:47:15 +0100
commit9274b37d99f608e5fde569788ee79bd72fc3cf13 (patch)
treec42beb7089a4aea6d915167c837ab075a0f9d4ae /src/test/ui/allocator
parente6225434fff7d493baac0aa91c57f2da923ea196 (diff)
downloadrust-9274b37d99f608e5fde569788ee79bd72fc3cf13.tar.gz
rust-9274b37d99f608e5fde569788ee79bd72fc3cf13.zip
Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`
Diffstat (limited to 'src/test/ui/allocator')
-rw-r--r--src/test/ui/allocator/custom.rs15
-rw-r--r--src/test/ui/allocator/xcrate-use.rs10
2 files changed, 12 insertions, 13 deletions
diff --git a/src/test/ui/allocator/custom.rs b/src/test/ui/allocator/custom.rs
index dfb5d3e9e38..10cbc23c427 100644
--- a/src/test/ui/allocator/custom.rs
+++ b/src/test/ui/allocator/custom.rs
@@ -8,9 +8,8 @@
 
 extern crate helper;
 
-use std::alloc::{self, AllocRef, Global, Layout, System};
+use std::alloc::{self, Allocator, Global, Layout, System};
 use std::sync::atomic::{AtomicUsize, Ordering};
-use std::ptr::NonNull;
 
 static HITS: AtomicUsize = AtomicUsize::new(0);
 
@@ -24,7 +23,7 @@ unsafe impl alloc::GlobalAlloc for A {
 
     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
         HITS.fetch_add(1, Ordering::SeqCst);
-        AllocRef::dealloc(&System, NonNull::new(ptr).unwrap(), layout)
+        alloc::GlobalAlloc::dealloc(&System, ptr, layout)
     }
 }
 
@@ -39,10 +38,10 @@ fn main() {
     unsafe {
         let layout = Layout::from_size_align(4, 2).unwrap();
 
-        let memory = Global.alloc(layout.clone()).unwrap();
+        let memory = Global.allocate(layout.clone()).unwrap();
         helper::work_with(&memory);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 1);
-        Global.dealloc(memory.as_non_null_ptr(), layout);
+        Global.deallocate(memory.as_non_null_ptr(), layout);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 2);
 
         let s = String::with_capacity(10);
@@ -51,10 +50,10 @@ fn main() {
         drop(s);
         assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
 
-        let memory = System.alloc(layout.clone()).unwrap();
-        assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
+        let memory = System.allocate(layout.clone()).unwrap();
         helper::work_with(&memory);
-        System.dealloc(memory.as_non_null_ptr(), layout);
+        assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
+        System.deallocate(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 a1446b3664d..edd4df75e8b 100644
--- a/src/test/ui/allocator/xcrate-use.rs
+++ b/src/test/ui/allocator/xcrate-use.rs
@@ -10,7 +10,7 @@
 extern crate custom;
 extern crate helper;
 
-use std::alloc::{AllocRef, Global, Layout, System};
+use std::alloc::{Allocator, Global, Layout, System};
 use std::sync::atomic::{AtomicUsize, Ordering};
 
 #[global_allocator]
@@ -21,16 +21,16 @@ fn main() {
         let n = GLOBAL.0.load(Ordering::SeqCst);
         let layout = Layout::from_size_align(4, 2).unwrap();
 
-        let memory = Global.alloc(layout.clone()).unwrap();
+        let memory = Global.allocate(layout.clone()).unwrap();
         helper::work_with(&memory);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
-        Global.dealloc(memory.as_non_null_ptr(), layout);
+        Global.deallocate(memory.as_non_null_ptr(), layout);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
 
-        let memory = System.alloc(layout.clone()).unwrap();
+        let memory = System.allocate(layout.clone()).unwrap();
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
         helper::work_with(&memory);
-        System.dealloc(memory.as_non_null_ptr(), layout);
+        System.deallocate(memory.as_non_null_ptr(), layout);
         assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
     }
 }