summaryrefslogtreecommitdiffstats
path: root/src/test/ui/allocator
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/allocator
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/allocator')
-rw-r--r--src/test/ui/allocator/allocator-args.rs13
-rw-r--r--src/test/ui/allocator/allocator-args.stderr8
-rw-r--r--src/test/ui/allocator/auxiliary/custom-as-global.rs16
-rw-r--r--src/test/ui/allocator/auxiliary/custom.rs21
-rw-r--r--src/test/ui/allocator/auxiliary/helper.rs11
-rw-r--r--src/test/ui/allocator/auxiliary/system-allocator.rs8
-rw-r--r--src/test/ui/allocator/auxiliary/system-allocator2.rs8
-rw-r--r--src/test/ui/allocator/custom-in-block.rs22
-rw-r--r--src/test/ui/allocator/custom-in-submodule.rs26
-rw-r--r--src/test/ui/allocator/custom.rs59
-rw-r--r--src/test/ui/allocator/function-allocator.rs4
-rw-r--r--src/test/ui/allocator/function-allocator.stderr8
-rw-r--r--src/test/ui/allocator/hygiene.rs31
-rw-r--r--src/test/ui/allocator/no_std-alloc-error-handler-custom.rs103
-rw-r--r--src/test/ui/allocator/no_std-alloc-error-handler-default.rs90
-rw-r--r--src/test/ui/allocator/not-an-allocator.rs8
-rw-r--r--src/test/ui/allocator/not-an-allocator.stderr47
-rw-r--r--src/test/ui/allocator/object-safe.rs13
-rw-r--r--src/test/ui/allocator/two-allocators.rs9
-rw-r--r--src/test/ui/allocator/two-allocators.stderr14
-rw-r--r--src/test/ui/allocator/two-allocators2.rs12
-rw-r--r--src/test/ui/allocator/two-allocators2.stderr4
-rw-r--r--src/test/ui/allocator/two-allocators3.rs10
-rw-r--r--src/test/ui/allocator/two-allocators3.stderr4
-rw-r--r--src/test/ui/allocator/xcrate-use.rs36
-rw-r--r--src/test/ui/allocator/xcrate-use2.rs47
26 files changed, 0 insertions, 632 deletions
diff --git a/src/test/ui/allocator/allocator-args.rs b/src/test/ui/allocator/allocator-args.rs
deleted file mode 100644
index 1033f947c..000000000
--- a/src/test/ui/allocator/allocator-args.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-use std::alloc::{GlobalAlloc, Layout};
-
-struct A;
-
-unsafe impl GlobalAlloc for A {
- unsafe fn alloc(&self, _: Layout) -> *mut u8 { panic!() }
- unsafe fn dealloc(&self, _: *mut u8, _: Layout) { panic!() }
-}
-
-#[global_allocator(malloc)] //~ ERROR malformed `global_allocator` attribute input
-static S: A = A;
-
-fn main() {}
diff --git a/src/test/ui/allocator/allocator-args.stderr b/src/test/ui/allocator/allocator-args.stderr
deleted file mode 100644
index dfff2a7e7..000000000
--- a/src/test/ui/allocator/allocator-args.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: malformed `global_allocator` attribute input
- --> $DIR/allocator-args.rs:10:1
- |
-LL | #[global_allocator(malloc)]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[global_allocator]`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/allocator/auxiliary/custom-as-global.rs b/src/test/ui/allocator/auxiliary/custom-as-global.rs
deleted file mode 100644
index a5e96e775..000000000
--- a/src/test/ui/allocator/auxiliary/custom-as-global.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-extern crate custom;
-
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-use custom::A;
-
-#[global_allocator]
-static ALLOCATOR: A = A(AtomicUsize::new(0));
-
-pub fn get() -> usize {
- ALLOCATOR.0.load(Ordering::SeqCst)
-}
diff --git a/src/test/ui/allocator/auxiliary/custom.rs b/src/test/ui/allocator/auxiliary/custom.rs
deleted file mode 100644
index b0ec9ab09..000000000
--- a/src/test/ui/allocator/auxiliary/custom.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// no-prefer-dynamic
-
-#![feature(allocator_api)]
-#![crate_type = "rlib"]
-
-use std::alloc::{GlobalAlloc, System, Layout};
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-pub struct A(pub AtomicUsize);
-
-unsafe impl GlobalAlloc for A {
- unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
- self.0.fetch_add(1, Ordering::SeqCst);
- System.alloc(layout)
- }
-
- unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
- self.0.fetch_add(1, Ordering::SeqCst);
- System.dealloc(ptr, layout)
- }
-}
diff --git a/src/test/ui/allocator/auxiliary/helper.rs b/src/test/ui/allocator/auxiliary/helper.rs
deleted file mode 100644
index 008fb3501..000000000
--- a/src/test/ui/allocator/auxiliary/helper.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-#![no_std]
-
-extern crate alloc;
-use alloc::fmt;
-
-pub fn work_with(p: &fmt::Debug) {
- drop(p);
-}
diff --git a/src/test/ui/allocator/auxiliary/system-allocator.rs b/src/test/ui/allocator/auxiliary/system-allocator.rs
deleted file mode 100644
index 97b86bbc9..000000000
--- a/src/test/ui/allocator/auxiliary/system-allocator.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-use std::alloc::System;
-
-#[global_allocator]
-static A: System = System;
diff --git a/src/test/ui/allocator/auxiliary/system-allocator2.rs b/src/test/ui/allocator/auxiliary/system-allocator2.rs
deleted file mode 100644
index 97b86bbc9..000000000
--- a/src/test/ui/allocator/auxiliary/system-allocator2.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-
-use std::alloc::System;
-
-#[global_allocator]
-static A: System = System;
diff --git a/src/test/ui/allocator/custom-in-block.rs b/src/test/ui/allocator/custom-in-block.rs
deleted file mode 100644
index 12813a1fc..000000000
--- a/src/test/ui/allocator/custom-in-block.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-// no-prefer-dynamic
-// aux-build:custom.rs
-// aux-build:helper.rs
-
-extern crate custom;
-extern crate helper;
-
-use custom::A;
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-fn main() {
- #[global_allocator]
- pub static GLOBAL: A = A(AtomicUsize::new(0));
-
- let n = GLOBAL.0.load(Ordering::SeqCst);
- let s = Box::new(0);
- helper::work_with(&s);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
- drop(s);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
-}
diff --git a/src/test/ui/allocator/custom-in-submodule.rs b/src/test/ui/allocator/custom-in-submodule.rs
deleted file mode 100644
index ea341b1ac..000000000
--- a/src/test/ui/allocator/custom-in-submodule.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// run-pass
-// no-prefer-dynamic
-// aux-build:custom.rs
-// aux-build:helper.rs
-
-extern crate custom;
-extern crate helper;
-
-use custom::A;
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-mod submodule {
- use super::*;
-
- #[global_allocator]
- pub static GLOBAL: A = A(AtomicUsize::new(0));
-}
-
-fn main() {
- let n = submodule::GLOBAL.0.load(Ordering::SeqCst);
- let s = Box::new(0);
- helper::work_with(&s);
- assert_eq!(submodule::GLOBAL.0.load(Ordering::SeqCst), n + 1);
- drop(s);
- assert_eq!(submodule::GLOBAL.0.load(Ordering::SeqCst), n + 2);
-}
diff --git a/src/test/ui/allocator/custom.rs b/src/test/ui/allocator/custom.rs
deleted file mode 100644
index 10cbc23c4..000000000
--- a/src/test/ui/allocator/custom.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-// run-pass
-
-// aux-build:helper.rs
-// no-prefer-dynamic
-
-#![feature(allocator_api)]
-#![feature(slice_ptr_get)]
-
-extern crate helper;
-
-use std::alloc::{self, Allocator, Global, Layout, System};
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-static HITS: AtomicUsize = AtomicUsize::new(0);
-
-struct A;
-
-unsafe impl alloc::GlobalAlloc for A {
- unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
- HITS.fetch_add(1, Ordering::SeqCst);
- alloc::GlobalAlloc::alloc(&System, layout)
- }
-
- unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
- HITS.fetch_add(1, Ordering::SeqCst);
- alloc::GlobalAlloc::dealloc(&System, ptr, layout)
- }
-}
-
-#[global_allocator]
-static GLOBAL: A = A;
-
-fn main() {
- println!("hello!");
-
- let n = HITS.load(Ordering::SeqCst);
- assert!(n > 0);
- unsafe {
- let layout = Layout::from_size_align(4, 2).unwrap();
-
- let memory = Global.allocate(layout.clone()).unwrap();
- helper::work_with(&memory);
- assert_eq!(HITS.load(Ordering::SeqCst), n + 1);
- Global.deallocate(memory.as_non_null_ptr(), layout);
- assert_eq!(HITS.load(Ordering::SeqCst), n + 2);
-
- let s = String::with_capacity(10);
- helper::work_with(&s);
- assert_eq!(HITS.load(Ordering::SeqCst), n + 3);
- drop(s);
- assert_eq!(HITS.load(Ordering::SeqCst), n + 4);
-
- let memory = System.allocate(layout.clone()).unwrap();
- helper::work_with(&memory);
- 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/function-allocator.rs b/src/test/ui/allocator/function-allocator.rs
deleted file mode 100644
index d53f6e9b7..000000000
--- a/src/test/ui/allocator/function-allocator.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[global_allocator]
-fn foo() {} //~ ERROR: allocators must be statics
-
-fn main() {}
diff --git a/src/test/ui/allocator/function-allocator.stderr b/src/test/ui/allocator/function-allocator.stderr
deleted file mode 100644
index 5e47b0f0c..000000000
--- a/src/test/ui/allocator/function-allocator.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: allocators must be statics
- --> $DIR/function-allocator.rs:2:1
- |
-LL | fn foo() {}
- | ^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/allocator/hygiene.rs b/src/test/ui/allocator/hygiene.rs
deleted file mode 100644
index 9bd8406a2..000000000
--- a/src/test/ui/allocator/hygiene.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// run-pass
-// no-prefer-dynamic
-// aux-build:custom.rs
-// aux-build:helper.rs
-
-#![allow(nonstandard_style)]
-
-extern crate custom;
-extern crate helper;
-
-use custom::A;
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-#[allow(dead_code)]
-struct u8;
-#[allow(dead_code)]
-struct usize;
-#[allow(dead_code)]
-static arg0: () = ();
-
-#[global_allocator]
-pub static GLOBAL: A = A(AtomicUsize::new(0));
-
-fn main() {
- let n = GLOBAL.0.load(Ordering::SeqCst);
- let s = Box::new(0);
- helper::work_with(&s);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
- drop(s);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
-}
diff --git a/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs b/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs
deleted file mode 100644
index 851da231a..000000000
--- a/src/test/ui/allocator/no_std-alloc-error-handler-custom.rs
+++ /dev/null
@@ -1,103 +0,0 @@
-// run-pass
-// ignore-android no libc
-// ignore-emscripten no libc
-// ignore-sgx no libc
-// ignore-wasm32 no libc
-// only-linux
-// compile-flags:-C panic=abort
-// aux-build:helper.rs
-
-#![feature(start, rustc_private, new_uninit, panic_info_message, lang_items)]
-#![feature(alloc_error_handler)]
-#![no_std]
-
-extern crate alloc;
-extern crate libc;
-
-// ARM targets need these symbols
-#[no_mangle]
-pub fn __aeabi_unwind_cpp_pr0() {}
-
-#[no_mangle]
-pub fn __aeabi_unwind_cpp_pr1() {}
-
-use core::ptr::null_mut;
-use core::alloc::{GlobalAlloc, Layout};
-use alloc::boxed::Box;
-
-extern crate helper;
-
-struct MyAllocator;
-
-#[alloc_error_handler]
-fn my_oom(layout: Layout) -> !
-{
- use alloc::fmt::write;
- unsafe {
- let size = layout.size();
- let mut s = alloc::string::String::new();
- write(&mut s, format_args!("My OOM: failed to allocate {} bytes!\n", size)).unwrap();
- let s = s.as_str();
- libc::write(libc::STDERR_FILENO, s as *const _ as _, s.len());
- libc::exit(0)
- }
-}
-
-unsafe impl GlobalAlloc for MyAllocator {
- unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
- if layout.size() < 4096 {
- libc::malloc(layout.size()) as _
- } else {
- null_mut()
- }
- }
- unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
-}
-
-#[global_allocator]
-static A: MyAllocator = MyAllocator;
-
-#[panic_handler]
-fn panic(panic_info: &core::panic::PanicInfo) -> ! {
- unsafe {
- if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
- const PSTR: &str = "panic occurred: ";
- const CR: &str = "\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- libc::write(libc::STDERR_FILENO, s as *const _ as _, s.len());
- libc::write(libc::STDERR_FILENO, CR as *const _ as _, CR.len());
- }
- if let Some(args) = panic_info.message() {
- let mut s = alloc::string::String::new();
- alloc::fmt::write(&mut s, *args).unwrap();
- let s = s.as_str();
- const PSTR: &str = "panic occurred: ";
- const CR: &str = "\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- libc::write(libc::STDERR_FILENO, s as *const _ as _, s.len());
- libc::write(libc::STDERR_FILENO, CR as *const _ as _, CR.len());
- } else {
- const PSTR: &str = "panic occurred\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- }
- libc::exit(1)
- }
-}
-
-// Because we are compiling this code with `-C panic=abort`, this wouldn't normally be needed.
-// However, `core` and `alloc` are both compiled with `-C panic=unwind`, which means that functions
-// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
-// unwind. So, for this test case we will define the symbol.
-#[lang = "eh_personality"]
-extern fn rust_eh_personality() {}
-
-#[derive(Debug)]
-struct Page(#[allow(unused_tuple_struct_fields)] [[u64; 32]; 16]);
-
-#[start]
-pub fn main(_argc: isize, _argv: *const *const u8) -> isize {
- let zero = Box::<Page>::new_zeroed();
- let zero = unsafe { zero.assume_init() };
- helper::work_with(&zero);
- 1
-}
diff --git a/src/test/ui/allocator/no_std-alloc-error-handler-default.rs b/src/test/ui/allocator/no_std-alloc-error-handler-default.rs
deleted file mode 100644
index 30ce0f162..000000000
--- a/src/test/ui/allocator/no_std-alloc-error-handler-default.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-// run-pass
-// ignore-android no libc
-// ignore-emscripten no libc
-// ignore-sgx no libc
-// ignore-wasm32 no libc
-// only-linux
-// compile-flags:-C panic=abort
-// aux-build:helper.rs
-// gate-test-default_alloc_error_handler
-
-#![feature(start, rustc_private, new_uninit, panic_info_message, lang_items)]
-#![feature(default_alloc_error_handler)]
-#![no_std]
-
-extern crate alloc;
-extern crate libc;
-
-// ARM targets need these symbols
-#[no_mangle]
-pub fn __aeabi_unwind_cpp_pr0() {}
-
-#[no_mangle]
-pub fn __aeabi_unwind_cpp_pr1() {}
-
-use alloc::boxed::Box;
-use core::alloc::{GlobalAlloc, Layout};
-use core::ptr::null_mut;
-
-extern crate helper;
-
-struct MyAllocator;
-
-unsafe impl GlobalAlloc for MyAllocator {
- unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
- if layout.size() < 4096 {
- libc::malloc(layout.size()) as _
- } else {
- null_mut()
- }
- }
- unsafe fn dealloc(&self, _ptr: *mut u8, _layout: Layout) {}
-}
-
-#[global_allocator]
-static A: MyAllocator = MyAllocator;
-
-#[panic_handler]
-fn panic(panic_info: &core::panic::PanicInfo) -> ! {
- unsafe {
- if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
- const PSTR: &str = "panic occurred: ";
- const CR: &str = "\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- libc::write(libc::STDERR_FILENO, s as *const _ as _, s.len());
- libc::write(libc::STDERR_FILENO, CR as *const _ as _, CR.len());
- }
- if let Some(args) = panic_info.message() {
- let mut s = alloc::string::String::new();
- alloc::fmt::write(&mut s, *args).unwrap();
- let s = s.as_str();
- const PSTR: &str = "panic occurred: ";
- const CR: &str = "\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- libc::write(libc::STDERR_FILENO, s as *const _ as _, s.len());
- libc::write(libc::STDERR_FILENO, CR as *const _ as _, CR.len());
- } else {
- const PSTR: &str = "panic occurred\n";
- libc::write(libc::STDERR_FILENO, PSTR as *const _ as _, PSTR.len());
- }
- libc::exit(0)
- }
-}
-
-// Because we are compiling this code with `-C panic=abort`, this wouldn't normally be needed.
-// However, `core` and `alloc` are both compiled with `-C panic=unwind`, which means that functions
-// in these libraries will refer to `rust_eh_personality` if LLVM can not *prove* the contents won't
-// unwind. So, for this test case we will define the symbol.
-#[lang = "eh_personality"]
-extern fn rust_eh_personality() {}
-
-#[derive(Debug)]
-struct Page(#[allow(unused_tuple_struct_fields)] [[u64; 32]; 16]);
-
-#[start]
-pub fn main(_argc: isize, _argv: *const *const u8) -> isize {
- let zero = Box::<Page>::new_zeroed();
- let zero = unsafe { zero.assume_init() };
- helper::work_with(&zero);
- 1
-}
diff --git a/src/test/ui/allocator/not-an-allocator.rs b/src/test/ui/allocator/not-an-allocator.rs
deleted file mode 100644
index 4a538d4d0..000000000
--- a/src/test/ui/allocator/not-an-allocator.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-#[global_allocator]
-static A: usize = 0;
-//~^ ERROR E0277
-//~| ERROR E0277
-//~| ERROR E0277
-//~| ERROR E0277
-
-fn main() {}
diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr
deleted file mode 100644
index 62bb0679f..000000000
--- a/src/test/ui/allocator/not-an-allocator.stderr
+++ /dev/null
@@ -1,47 +0,0 @@
-error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
- --> $DIR/not-an-allocator.rs:2:11
- |
-LL | #[global_allocator]
- | ------------------- in this procedural macro expansion
-LL | static A: usize = 0;
- | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
- |
- = help: the trait `GlobalAlloc` is implemented for `System`
- = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
- --> $DIR/not-an-allocator.rs:2:11
- |
-LL | #[global_allocator]
- | ------------------- in this procedural macro expansion
-LL | static A: usize = 0;
- | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
- |
- = help: the trait `GlobalAlloc` is implemented for `System`
- = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
- --> $DIR/not-an-allocator.rs:2:11
- |
-LL | #[global_allocator]
- | ------------------- in this procedural macro expansion
-LL | static A: usize = 0;
- | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
- |
- = help: the trait `GlobalAlloc` is implemented for `System`
- = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied
- --> $DIR/not-an-allocator.rs:2:11
- |
-LL | #[global_allocator]
- | ------------------- in this procedural macro expansion
-LL | static A: usize = 0;
- | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize`
- |
- = help: the trait `GlobalAlloc` is implemented for `System`
- = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/allocator/object-safe.rs b/src/test/ui/allocator/object-safe.rs
deleted file mode 100644
index fae7ab7fe..000000000
--- a/src/test/ui/allocator/object-safe.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// run-pass
-
-// Check that `Allocator` is object safe, this allows for polymorphic allocators
-
-#![feature(allocator_api)]
-
-use std::alloc::{Allocator, System};
-
-fn ensure_object_safe(_: &dyn Allocator) {}
-
-fn main() {
- ensure_object_safe(&System);
-}
diff --git a/src/test/ui/allocator/two-allocators.rs b/src/test/ui/allocator/two-allocators.rs
deleted file mode 100644
index aa1291e77..000000000
--- a/src/test/ui/allocator/two-allocators.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-use std::alloc::System;
-
-#[global_allocator]
-static A: System = System;
-#[global_allocator]
-static B: System = System;
-//~^ ERROR: cannot define multiple global allocators
-
-fn main() {}
diff --git a/src/test/ui/allocator/two-allocators.stderr b/src/test/ui/allocator/two-allocators.stderr
deleted file mode 100644
index 7a914c2a3..000000000
--- a/src/test/ui/allocator/two-allocators.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: cannot define multiple global allocators
- --> $DIR/two-allocators.rs:6:1
- |
-LL | static A: System = System;
- | -------------------------- previous global allocator defined here
-LL | #[global_allocator]
- | ------------------- in this procedural macro expansion
-LL | static B: System = System;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot define a new global allocator
- |
- = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/allocator/two-allocators2.rs b/src/test/ui/allocator/two-allocators2.rs
deleted file mode 100644
index 6dfefe19c..000000000
--- a/src/test/ui/allocator/two-allocators2.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// aux-build:system-allocator.rs
-// no-prefer-dynamic
-// error-pattern: the `#[global_allocator]` in
-
-extern crate system_allocator;
-
-use std::alloc::System;
-
-#[global_allocator]
-static A: System = System;
-
-fn main() {}
diff --git a/src/test/ui/allocator/two-allocators2.stderr b/src/test/ui/allocator/two-allocators2.stderr
deleted file mode 100644
index b1fb4421e..000000000
--- a/src/test/ui/allocator/two-allocators2.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: the `#[global_allocator]` in this crate conflicts with global allocator in: system_allocator
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/allocator/two-allocators3.rs b/src/test/ui/allocator/two-allocators3.rs
deleted file mode 100644
index 31dea2d44..000000000
--- a/src/test/ui/allocator/two-allocators3.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// aux-build:system-allocator.rs
-// aux-build:system-allocator2.rs
-// no-prefer-dynamic
-// error-pattern: the `#[global_allocator]` in
-
-
-extern crate system_allocator;
-extern crate system_allocator2;
-
-fn main() {}
diff --git a/src/test/ui/allocator/two-allocators3.stderr b/src/test/ui/allocator/two-allocators3.stderr
deleted file mode 100644
index a3079113d..000000000
--- a/src/test/ui/allocator/two-allocators3.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-error: the `#[global_allocator]` in system_allocator conflicts with global allocator in: system_allocator2
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/allocator/xcrate-use.rs b/src/test/ui/allocator/xcrate-use.rs
deleted file mode 100644
index edd4df75e..000000000
--- a/src/test/ui/allocator/xcrate-use.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-
-// aux-build:custom.rs
-// aux-build:helper.rs
-// no-prefer-dynamic
-
-#![feature(allocator_api)]
-#![feature(slice_ptr_get)]
-
-extern crate custom;
-extern crate helper;
-
-use std::alloc::{Allocator, Global, Layout, System};
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-#[global_allocator]
-static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
-
-fn main() {
- unsafe {
- let n = GLOBAL.0.load(Ordering::SeqCst);
- let layout = Layout::from_size_align(4, 2).unwrap();
-
- let memory = Global.allocate(layout.clone()).unwrap();
- helper::work_with(&memory);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1);
- Global.deallocate(memory.as_non_null_ptr(), layout);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
-
- let memory = System.allocate(layout.clone()).unwrap();
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
- helper::work_with(&memory);
- System.deallocate(memory.as_non_null_ptr(), layout);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2);
- }
-}
diff --git a/src/test/ui/allocator/xcrate-use2.rs b/src/test/ui/allocator/xcrate-use2.rs
deleted file mode 100644
index d8478fb5e..000000000
--- a/src/test/ui/allocator/xcrate-use2.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-// run-pass
-
-// aux-build:custom.rs
-// aux-build:custom-as-global.rs
-// aux-build:helper.rs
-// no-prefer-dynamic
-
-#![feature(allocator_api)]
-
-extern crate custom;
-extern crate custom_as_global;
-extern crate helper;
-
-use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout};
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-static GLOBAL: custom::A = custom::A(AtomicUsize::new(0));
-
-fn main() {
- unsafe {
- let n = custom_as_global::get();
- let layout = Layout::from_size_align(4, 2).unwrap();
-
- // Global allocator routes to the `custom_as_global` global
- let ptr = alloc(layout.clone());
- helper::work_with(&ptr);
- assert_eq!(custom_as_global::get(), n + 1);
- dealloc(ptr, layout.clone());
- assert_eq!(custom_as_global::get(), n + 2);
-
- // Usage of the system allocator avoids all globals
- let ptr = System.alloc(layout.clone());
- helper::work_with(&ptr);
- assert_eq!(custom_as_global::get(), n + 2);
- System.dealloc(ptr, layout.clone());
- assert_eq!(custom_as_global::get(), n + 2);
-
- // Usage of our personal allocator doesn't affect other instances
- let ptr = GLOBAL.alloc(layout.clone());
- helper::work_with(&ptr);
- assert_eq!(custom_as_global::get(), n + 2);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 1);
- GLOBAL.dealloc(ptr, layout);
- assert_eq!(custom_as_global::get(), n + 2);
- assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2);
- }
-}