about summary refs log tree commit diff
path: root/src/test
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
parente6225434fff7d493baac0aa91c57f2da923ea196 (diff)
Rename `AllocRef` to `Allocator` and `(de)alloc` to `(de)allocate`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/allocator/custom.rs15
-rw-r--r--src/test/ui/allocator/xcrate-use.rs10
-rw-r--r--src/test/ui/associated-types/defaults-wf.stderr2
-rw-r--r--src/test/ui/bad/bad-sized.stderr2
-rw-r--r--src/test/ui/box/leak-alloc.rs16
-rw-r--r--src/test/ui/error-codes/e0119/conflict-with-std.stderr2
-rw-r--r--src/test/ui/issues/issue-20433.stderr2
-rw-r--r--src/test/ui/issues/issue-41974.stderr2
-rw-r--r--src/test/ui/realloc-16687.rs6
-rw-r--r--src/test/ui/regions/regions-mock-codegen.rs10
-rw-r--r--src/test/ui/unique-object-noncopyable.stderr2
-rw-r--r--src/test/ui/unique-pinned-nocopy.stderr2
12 files changed, 35 insertions, 36 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);
     }
 }
diff --git a/src/test/ui/associated-types/defaults-wf.stderr b/src/test/ui/associated-types/defaults-wf.stderr
index 26c85260194..4c43e6a182d 100644
--- a/src/test/ui/associated-types/defaults-wf.stderr
+++ b/src/test/ui/associated-types/defaults-wf.stderr
@@ -6,7 +6,7 @@ LL |     type Ty = Vec<[u8]>;
    | 
   ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
    |
-LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global> {
+LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
    |
    = help: the trait `Sized` is not implemented for `[u8]`
diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr
index 10d12a09b25..60a5bb9f786 100644
--- a/src/test/ui/bad/bad-sized.stderr
+++ b/src/test/ui/bad/bad-sized.stderr
@@ -17,7 +17,7 @@ LL |     let x: Vec<dyn Trait + Sized> = Vec::new();
    | 
   ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
    |
-LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global> {
+LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
    |
    = help: the trait `Sized` is not implemented for `dyn Trait`
diff --git a/src/test/ui/box/leak-alloc.rs b/src/test/ui/box/leak-alloc.rs
index 2e73d6f1432..3f0f39f448b 100644
--- a/src/test/ui/box/leak-alloc.rs
+++ b/src/test/ui/box/leak-alloc.rs
@@ -1,26 +1,26 @@
 #![feature(allocator_api)]
 
-use std::alloc::{AllocError, AllocRef, Layout, System};
+use std::alloc::{AllocError, Allocator, Layout, System};
 use std::ptr::NonNull;
 
 use std::boxed::Box;
 
-struct Allocator {}
+struct Alloc {}
 
-unsafe impl AllocRef for Allocator {
-    fn alloc(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
-        System.alloc(layout)
+unsafe impl Allocator for Alloc {
+    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
+        System.allocate(layout)
     }
 
-    unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout) {
-        System.dealloc(ptr, layout)
+    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
+        System.deallocate(ptr, layout)
     }
 }
 
 fn use_value(_: u32) {}
 
 fn main() {
-    let alloc = Allocator {};
+    let alloc = Alloc {};
     let boxed = Box::new_in(10, alloc.by_ref());
     let theref = Box::leak(boxed);
     drop(alloc);
diff --git a/src/test/ui/error-codes/e0119/conflict-with-std.stderr b/src/test/ui/error-codes/e0119/conflict-with-std.stderr
index 9dc1a509cd0..68551f43775 100644
--- a/src/test/ui/error-codes/e0119/conflict-with-std.stderr
+++ b/src/test/ui/error-codes/e0119/conflict-with-std.stderr
@@ -6,7 +6,7 @@ LL | impl AsRef<Q> for Box<Q> {
    |
    = note: conflicting implementation in crate `alloc`:
            - impl<T, A> AsRef<T> for Box<T, A>
-             where A: AllocRef, T: ?Sized;
+             where A: Allocator, T: ?Sized;
 
 error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`:
   --> $DIR/conflict-with-std.rs:12:1
diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr
index d40946ae03f..3f7226c79bf 100644
--- a/src/test/ui/issues/issue-20433.stderr
+++ b/src/test/ui/issues/issue-20433.stderr
@@ -6,7 +6,7 @@ LL |     fn iceman(c: Vec<[i32]>) {}
    | 
   ::: $SRC_DIR/alloc/src/vec.rs:LL:COL
    |
-LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global> {
+LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
    |                - required by this bound in `Vec`
    |
    = help: the trait `Sized` is not implemented for `[i32]`
diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr
index cc4b3707dd6..cde285f73d6 100644
--- a/src/test/ui/issues/issue-41974.stderr
+++ b/src/test/ui/issues/issue-41974.stderr
@@ -6,7 +6,7 @@ LL | impl<T> Drop for T where T: A {
    |
    = note: conflicting implementation in crate `alloc`:
            - impl<T, A> Drop for Box<T, A>
-             where A: AllocRef, T: ?Sized;
+             where A: Allocator, T: ?Sized;
    = note: downstream crates may implement trait `A` for type `std::boxed::Box<_, _>`
 
 error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions
diff --git a/src/test/ui/realloc-16687.rs b/src/test/ui/realloc-16687.rs
index 2e07fdcbe83..92d98c16c60 100644
--- a/src/test/ui/realloc-16687.rs
+++ b/src/test/ui/realloc-16687.rs
@@ -7,7 +7,7 @@
 #![feature(allocator_api)]
 #![feature(slice_ptr_get)]
 
-use std::alloc::{handle_alloc_error, AllocRef, Global, Layout};
+use std::alloc::{handle_alloc_error, Allocator, Global, Layout};
 use std::ptr::{self, NonNull};
 
 fn main() {
@@ -42,7 +42,7 @@ unsafe fn test_triangle() -> bool {
             println!("allocate({:?})", layout);
         }
 
-        let ptr = Global.alloc(layout).unwrap_or_else(|_| handle_alloc_error(layout));
+        let ptr = Global.allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout));
 
         if PRINT {
             println!("allocate({:?}) = {:?}", layout, ptr);
@@ -56,7 +56,7 @@ unsafe fn test_triangle() -> bool {
             println!("deallocate({:?}, {:?}", ptr, layout);
         }
 
-        Global.dealloc(NonNull::new_unchecked(ptr), layout);
+        Global.deallocate(NonNull::new_unchecked(ptr), layout);
     }
 
     unsafe fn reallocate(ptr: *mut u8, old: Layout, new: Layout) -> *mut u8 {
diff --git a/src/test/ui/regions/regions-mock-codegen.rs b/src/test/ui/regions/regions-mock-codegen.rs
index ad4b9c352ae..9d0ca76e409 100644
--- a/src/test/ui/regions/regions-mock-codegen.rs
+++ b/src/test/ui/regions/regions-mock-codegen.rs
@@ -4,7 +4,7 @@
 // pretty-expanded FIXME #23616
 #![feature(allocator_api)]
 
-use std::alloc::{handle_alloc_error, AllocRef, Global, Layout};
+use std::alloc::{handle_alloc_error, Allocator, Global, Layout};
 use std::ptr::NonNull;
 
 struct arena(());
@@ -22,23 +22,23 @@ struct Ccx {
     x: isize,
 }
 
-fn alloc(_bcx: &arena) -> &Bcx<'_> {
+fn allocate(_bcx: &arena) -> &Bcx<'_> {
     unsafe {
         let layout = Layout::new::<Bcx>();
-        let ptr = Global.alloc(layout).unwrap_or_else(|_| handle_alloc_error(layout));
+        let ptr = Global.allocate(layout).unwrap_or_else(|_| handle_alloc_error(layout));
         &*(ptr.as_ptr() as *const _)
     }
 }
 
 fn h<'a>(bcx: &'a Bcx<'a>) -> &'a Bcx<'a> {
-    return alloc(bcx.fcx.arena);
+    return allocate(bcx.fcx.arena);
 }
 
 fn g(fcx: &Fcx) {
     let bcx = Bcx { fcx };
     let bcx2 = h(&bcx);
     unsafe {
-        Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
+        Global.deallocate(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::<Bcx>());
     }
 }
 
diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr
index 2e23ddd9053..09cbb875338 100644
--- a/src/test/ui/unique-object-noncopyable.stderr
+++ b/src/test/ui/unique-object-noncopyable.stderr
@@ -22,7 +22,7 @@ LL |       fn clone(&self) -> Self;
    |
 LL | / pub struct Box<
 LL | |     T: ?Sized,
-LL | |     #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global,
+LL | |     #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
 LL | | >(Unique<T>, A);
    | |________________- doesn't satisfy `Box<dyn Foo>: Clone`
    |
diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr
index d533724a009..bc081024182 100644
--- a/src/test/ui/unique-pinned-nocopy.stderr
+++ b/src/test/ui/unique-pinned-nocopy.stderr
@@ -19,7 +19,7 @@ LL |       fn clone(&self) -> Self;
    |
 LL | / pub struct Box<
 LL | |     T: ?Sized,
-LL | |     #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global,
+LL | |     #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
 LL | | >(Unique<T>, A);
    | |________________- doesn't satisfy `Box<R>: Clone`
    |