summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/miri_unleashed
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/miri_unleashed')
-rw-r--r--src/test/ui/consts/miri_unleashed/abi-mismatch.rs18
-rw-r--r--src/test/ui/consts/miri_unleashed/abi-mismatch.stderr28
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.rs30
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.stderr51
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const_2.rs28
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const_2.stderr27
-rw-r--r--src/test/ui/consts/miri_unleashed/auxiliary/static_cross_crate.rs3
-rw-r--r--src/test/ui/consts/miri_unleashed/box.rs12
-rw-r--r--src/test/ui/consts/miri_unleashed/box.stderr32
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr81
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr81
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.rs33
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr138
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr138
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs76
-rw-r--r--src/test/ui/consts/miri_unleashed/drop.rs17
-rw-r--r--src/test/ui/consts/miri_unleashed/drop.stderr28
-rw-r--r--src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs26
-rw-r--r--src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr11
-rw-r--r--src/test/ui/consts/miri_unleashed/inline_asm.rs13
-rw-r--r--src/test/ui/consts/miri_unleashed/inline_asm.stderr17
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references.rs36
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references.stderr37
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr54
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr54
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_err.rs36
-rw-r--r--src/test/ui/consts/miri_unleashed/mutating_global.rs15
-rw-r--r--src/test/ui/consts/miri_unleashed/mutating_global.stderr9
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.rs11
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.stderr17
-rw-r--r--src/test/ui/consts/miri_unleashed/ptr_arith.rs24
-rw-r--r--src/test/ui/consts/miri_unleashed/ptr_arith.stderr26
-rw-r--r--src/test/ui/consts/miri_unleashed/raw_mutable_const.rs8
-rw-r--r--src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr16
-rw-r--r--src/test/ui/consts/miri_unleashed/slice_eq.rs13
-rw-r--r--src/test/ui/consts/miri_unleashed/tls.rs23
-rw-r--r--src/test/ui/consts/miri_unleashed/tls.stderr28
37 files changed, 0 insertions, 1295 deletions
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs
deleted file mode 100644
index 205f7183b..000000000
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Checks that we report ABI mismatches for "const extern fn"
-// compile-flags: -Z unleash-the-miri-inside-of-you
-
-#![feature(const_extern_fn)]
-
-const extern "C" fn c_fn() {}
-
-const fn call_rust_fn(my_fn: extern "Rust" fn()) {
- my_fn();
- //~^ ERROR could not evaluate static initializer
- //~| NOTE calling a function with calling convention C using calling convention Rust
- //~| NOTE inside `call_rust_fn`
-}
-
-static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-//~^ NOTE inside `VAL`
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
deleted file mode 100644
index cf3fd88d0..000000000
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/abi-mismatch.rs:9:5
- |
-LL | my_fn();
- | ^^^^^^^ calling a function with calling convention C using calling convention Rust
- |
-note: inside `call_rust_fn`
- --> $DIR/abi-mismatch.rs:9:5
- |
-LL | my_fn();
- | ^^^^^^^
-note: inside `VAL`
- --> $DIR/abi-mismatch.rs:15:18
- |
-LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/abi-mismatch.rs:9:5
- |
-LL | my_fn();
- | ^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs
deleted file mode 100644
index 7bb0c1b77..000000000
--- a/src/test/ui/consts/miri_unleashed/assoc_const.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// build-fail
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-// a test demonstrating why we do need to run static const qualification on associated constants
-// instead of just checking the final constant
-
-trait Foo<T> {
- const X: T;
-}
-
-trait Bar<T, U: Foo<T>> {
- const F: u32 = (U::X, 42).1;
-}
-
-impl Foo<u32> for () {
- const X: u32 = 42;
-}
-impl Foo<Vec<u32>> for String {
- const X: Vec<u32> = Vec::new();
-}
-
-impl Bar<u32, ()> for () {}
-impl Bar<Vec<u32>, String> for String {}
-
-fn main() {
- // this is fine, but would have been forbidden by the static checks on `F`
- let x = <() as Bar<u32, ()>>::F;
- // this test only causes errors due to the line below, so post-monomorphization
- let y = <String as Bar<Vec<u32>, String>>::F; //~ constant
-}
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr
deleted file mode 100644
index b26f121db..000000000
--- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr
+++ /dev/null
@@ -1,51 +0,0 @@
-error[E0080]: evaluation of `<std::string::String as Bar<std::vec::Vec<u32>, std::string::String>>::F` failed
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
-LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<Vec<u32> as Drop>::drop`
- |
-note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))`
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
-LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))`
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
-LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: inside `<String as Bar<Vec<u32>, String>>::F`
- --> $DIR/assoc_const.rs:12:31
- |
-LL | const F: u32 = (U::X, 42).1;
- | ^
-
-note: erroneous constant used
- --> $DIR/assoc_const.rs:29:13
- |
-LL | let y = <String as Bar<Vec<u32>, String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-note: erroneous constant used
- --> $DIR/assoc_const.rs:29:13
- |
-LL | let y = <String as Bar<Vec<u32>, String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-note: erroneous constant used
- --> $DIR/assoc_const.rs:29:13
- |
-LL | let y = <String as Bar<Vec<u32>, String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/assoc_const.rs:12:20
- |
-LL | const F: u32 = (U::X, 42).1;
- | ^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs
deleted file mode 100644
index aad5b3460..000000000
--- a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// build-fail
-
-// a test demonstrating that const qualification cannot prevent monomorphization time errors
-
-trait Foo {
- const X: u32;
-}
-
-trait Bar<U: Foo> {
- const F: u32 = 100 / U::X; //~ ERROR evaluation of `<std::string::String as Bar<std::string::String>>::F` failed
-}
-
-impl Foo for () {
- const X: u32 = 42;
-}
-
-impl Foo for String {
- const X: u32 = 0;
-}
-
-impl Bar<()> for () {}
-impl Bar<String> for String {}
-
-fn main() {
- let x = <() as Bar<()>>::F;
- // this test only causes errors due to the line below, so post-monomorphization
- let y = <String as Bar<String>>::F; //~ constant
-}
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr
deleted file mode 100644
index fc4b18056..000000000
--- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0080]: evaluation of `<std::string::String as Bar<std::string::String>>::F` failed
- --> $DIR/assoc_const_2.rs:10:20
- |
-LL | const F: u32 = 100 / U::X;
- | ^^^^^^^^^^ attempt to divide `100_u32` by zero
-
-note: erroneous constant used
- --> $DIR/assoc_const_2.rs:27:13
- |
-LL | let y = <String as Bar<String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-note: erroneous constant used
- --> $DIR/assoc_const_2.rs:27:13
- |
-LL | let y = <String as Bar<String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-note: erroneous constant used
- --> $DIR/assoc_const_2.rs:27:13
- |
-LL | let y = <String as Bar<String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/auxiliary/static_cross_crate.rs b/src/test/ui/consts/miri_unleashed/auxiliary/static_cross_crate.rs
deleted file mode 100644
index 4fc6ae66a..000000000
--- a/src/test/ui/consts/miri_unleashed/auxiliary/static_cross_crate.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub static mut ZERO: [u8; 1] = [0];
-pub static ZERO_REF: &[u8; 1] = unsafe { &ZERO };
-pub static mut OPT_ZERO: Option<u8> = Some(0);
diff --git a/src/test/ui/consts/miri_unleashed/box.rs b/src/test/ui/consts/miri_unleashed/box.rs
deleted file mode 100644
index c2a260aa1..000000000
--- a/src/test/ui/consts/miri_unleashed/box.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(box_syntax)]
-
-use std::mem::ManuallyDrop;
-
-fn main() {}
-
-static TEST_BAD: &mut i32 = {
- &mut *(box 0)
- //~^ ERROR could not evaluate static initializer
- //~| NOTE calling non-const function `alloc::alloc::exchange_malloc`
-};
diff --git a/src/test/ui/consts/miri_unleashed/box.stderr b/src/test/ui/consts/miri_unleashed/box.stderr
deleted file mode 100644
index bc5d4a257..000000000
--- a/src/test/ui/consts/miri_unleashed/box.stderr
+++ /dev/null
@@ -1,32 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/box.rs:9:11
- |
-LL | &mut *(box 0)
- | ^^^^^^^ calling non-const function `alloc::alloc::exchange_malloc`
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/box.rs:9:11
- |
-LL | &mut *(box 0)
- | ^^^^^^^
-help: skipping check for `const_mut_refs` feature
- --> $DIR/box.rs:9:16
- |
-LL | &mut *(box 0)
- | ^
-help: skipping check for `const_mut_refs` feature
- --> $DIR/box.rs:9:5
- |
-LL | &mut *(box 0)
- | ^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/box.rs:9:5
- |
-LL | &mut *(box 0)
- | ^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
deleted file mode 100644
index a6f467b9e..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.32bit.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add`
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:14:14
- |
-LL | unsafe { *(&FOO as *const _ as *const usize) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^ constant accesses static
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static.rs:20:1
- |
-LL | const REF_INTERIOR_MUT: &usize = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc4──╼ │ ╾──╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static.rs:27:1
- |
-LL | const READ_IMMUT: &usize = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc5──╼ │ ╾──╼
- }
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:14:17
- |
-LL | unsafe { *(&FOO as *const _ as *const usize) }
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:23:18
- |
-LL | unsafe { &*(&FOO as *const _ as *const usize) }
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:30:6
- |
-LL | &FOO
- | ^^^
-
-error: aborting due to 5 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
deleted file mode 100644
index cfaf31a6e..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.64bit.stderr
+++ /dev/null
@@ -1,81 +0,0 @@
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add`
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:14:14
- |
-LL | unsafe { *(&FOO as *const _ as *const usize) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^ constant accesses static
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static.rs:20:1
- |
-LL | const REF_INTERIOR_MUT: &usize = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc4────────╼ │ ╾──────╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static.rs:27:1
- |
-LL | const READ_IMMUT: &usize = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc5────────╼ │ ╾──────╼
- }
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:9:5
- |
-LL | FOO.fetch_add(1, Ordering::Relaxed)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:14:17
- |
-LL | unsafe { *(&FOO as *const _ as *const usize) }
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:18:32
- |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:23:18
- |
-LL | unsafe { &*(&FOO as *const _ as *const usize) }
- | ^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static.rs:30:6
- |
-LL | &FOO
- | ^^^
-
-error: aborting due to 5 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
deleted file mode 100644
index 7ed5a48d9..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-// stderr-per-bitwidth
-
-use std::sync::atomic::AtomicUsize;
-use std::sync::atomic::Ordering;
-
-const MUTATE_INTERIOR_MUT: usize = {
- static FOO: AtomicUsize = AtomicUsize::new(0);
- FOO.fetch_add(1, Ordering::Relaxed) //~ERROR evaluation of constant value failed
-};
-
-const READ_INTERIOR_MUT: usize = {
- static FOO: AtomicUsize = AtomicUsize::new(0);
- unsafe { *(&FOO as *const _ as *const usize) } //~ERROR evaluation of constant value failed
-};
-
-static mut MUTABLE: u32 = 0;
-const READ_MUT: u32 = unsafe { MUTABLE }; //~ERROR evaluation of constant value failed
-
-const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value
-//~| encountered a reference pointing to a static variable
- static FOO: AtomicUsize = AtomicUsize::new(0);
- unsafe { &*(&FOO as *const _ as *const usize) }
-};
-
-// ok some day perhaps
-const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value
-//~| encountered a reference pointing to a static variable
- static FOO: usize = 0;
- &FOO
-};
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
deleted file mode 100644
index 6df2fe3d0..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static_cross_crate.rs:10:1
- |
-LL | const SLICE_MUT: &[u8; 1] = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
- }
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static_cross_crate.rs:15:1
- |
-LL | const U8_MUT: &u8 = {
- | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc1──╼ │ ╾──╼
- }
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static_cross_crate.rs:22:15
- |
-LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:12:15
- |
-LL | unsafe { &static_cross_crate::ZERO }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:12:15
- |
-LL | unsafe { &static_cross_crate::ZERO }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:22:17
- |
-LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 12 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
deleted file mode 100644
index 8802f3ada..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
+++ /dev/null
@@ -1,138 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static_cross_crate.rs:10:1
- |
-LL | const SLICE_MUT: &[u8; 1] = {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
- }
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/const_refers_to_static_cross_crate.rs:15:1
- |
-LL | const U8_MUT: &u8 = {
- | ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to a static variable in a constant
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc1────────╼ │ ╾──────╼
- }
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static_cross_crate.rs:22:15
- |
-LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error[E0080]: evaluation of constant value failed
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:12:15
- |
-LL | unsafe { &static_cross_crate::ZERO }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:12:15
- |
-LL | unsafe { &static_cross_crate::ZERO }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:17:15
- |
-LL | unsafe { &static_cross_crate::ZERO[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:22:17
- |
-LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/const_refers_to_static_cross_crate.rs:27:20
- |
-LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 12 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
deleted file mode 100644
index bf4f14f4d..000000000
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
+++ /dev/null
@@ -1,76 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-// aux-build:static_cross_crate.rs
-// stderr-per-bitwidth
-#![feature(exclusive_range_pattern, half_open_range_patterns_in_slices)]
-
-extern crate static_cross_crate;
-
-// Sneaky: reference to a mutable static.
-// Allowing this would be a disaster for pattern matching, we could violate exhaustiveness checking!
-const SLICE_MUT: &[u8; 1] = { //~ ERROR undefined behavior to use this value
-//~| encountered a reference pointing to a static variable
- unsafe { &static_cross_crate::ZERO }
-};
-
-const U8_MUT: &u8 = { //~ ERROR undefined behavior to use this value
-//~| encountered a reference pointing to a static variable
- unsafe { &static_cross_crate::ZERO[0] }
-};
-
-// Also test indirection that reads from other static.
-const U8_MUT2: &u8 = {
- unsafe { &(*static_cross_crate::ZERO_REF)[0] }
- //~^ ERROR evaluation of constant value failed
- //~| constant accesses static
-};
-const U8_MUT3: &u8 = {
- unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
- //~^ ERROR evaluation of constant value failed
- //~| constant accesses static
-};
-
-pub fn test(x: &[u8; 1]) -> bool {
- match x {
- SLICE_MUT => true,
- //~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
- &[1..] => false,
- }
-}
-
-pub fn test2(x: &u8) -> bool {
- match x {
- U8_MUT => true,
- //~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
- &(1..) => false,
- }
-}
-
-// We need to use these *in a pattern* to trigger the failure... likely because
-// the errors above otherwise stop compilation too early?
-pub fn test3(x: &u8) -> bool {
- match x {
- U8_MUT2 => true,
- //~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
- &(1..) => false,
- }
-}
-pub fn test4(x: &u8) -> bool {
- match x {
- U8_MUT3 => true,
- //~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
- &(1..) => false,
- }
-}
-
-fn main() {
- unsafe {
- static_cross_crate::ZERO[0] = 1;
- }
- // Now the pattern is not exhaustive any more!
- test(&[0]);
- test2(&0);
-}
diff --git a/src/test/ui/consts/miri_unleashed/drop.rs b/src/test/ui/consts/miri_unleashed/drop.rs
deleted file mode 100644
index 3942e7ef7..000000000
--- a/src/test/ui/consts/miri_unleashed/drop.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-// error-pattern: calling non-const function `<Vec<i32> as Drop>::drop`
-
-use std::mem::ManuallyDrop;
-
-fn main() {}
-
-static TEST_OK: () = {
- let v: Vec<i32> = Vec::new();
- let _v = ManuallyDrop::new(v);
-};
-
-// Make sure we catch executing bad drop functions.
-// The actual error is tested by the error-pattern above.
-static TEST_BAD: () = {
- let _v: Vec<i32> = Vec::new();
-};
diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr
deleted file mode 100644
index e2e2f16d5..000000000
--- a/src/test/ui/consts/miri_unleashed/drop.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
-LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<Vec<i32> as Drop>::drop`
- |
-note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
-LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: inside `TEST_BAD`
- --> $DIR/drop.rs:17:1
- |
-LL | };
- | ^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/drop.rs:16:9
- |
-LL | let _v: Vec<i32> = Vec::new();
- | ^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs
deleted file mode 100644
index c24d3338e..000000000
--- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// a test demonstrating why we do need to run static const qualification on associated constants
-// instead of just checking the final constant
-
-trait Foo<T> {
- const X: T;
-}
-
-trait Bar<T, U: Foo<T>> {
- const F: u32 = (U::X, 42).1; //~ ERROR destructor of
-}
-
-impl Foo<u32> for () {
- const X: u32 = 42;
-}
-
-impl Foo<Vec<u32>> for String {
- const X: Vec<u32> = Vec::new();
-}
-
-impl Bar<u32, ()> for () {}
-impl Bar<Vec<u32>, String> for String {}
-
-fn main() {
- let x = <() as Bar<u32, ()>>::F;
- let y = <String as Bar<Vec<u32>, String>>::F;
-}
diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr
deleted file mode 100644
index 45ed88b1b..000000000
--- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0493]: destructor of `(T, u32)` cannot be evaluated at compile-time
- --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:9:20
- |
-LL | const F: u32 = (U::X, 42).1;
- | ^^^^^^^^^^ - value is dropped here
- | |
- | the destructor for this type cannot be evaluated in constants
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0493`.
diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs
deleted file mode 100644
index 6fd52ceb2..000000000
--- a/src/test/ui/consts/miri_unleashed/inline_asm.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-// only-x86_64
-
-use std::arch::asm;
-
-fn main() {}
-
-// Make sure we catch executing inline assembly.
-static TEST_BAD: () = {
- unsafe { asm!("nop"); }
- //~^ ERROR could not evaluate static initializer
- //~| NOTE inline assembly is not supported
-};
diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr
deleted file mode 100644
index 6317cd882..000000000
--- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/inline_asm.rs:10:14
- |
-LL | unsafe { asm!("nop"); }
- | ^^^^^^^^^^^ inline assembly is not supported
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/inline_asm.rs:10:14
- |
-LL | unsafe { asm!("nop"); }
- | ^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs
deleted file mode 100644
index 4e9964647..000000000
--- a/src/test/ui/consts/miri_unleashed/mutable_references.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-use std::cell::UnsafeCell;
-
-// a test demonstrating what things we could allow with a smarter const qualification
-
-// this is fine because is not possible to mutate through an immutable reference.
-static FOO: &&mut u32 = &&mut 42;
-
-// this is fine because accessing an immutable static `BAR` is equivalent to accessing `*&BAR`
-// which puts the mutable reference behind an immutable one.
-static BAR: &mut () = &mut ();
-
-struct Foo<T>(T);
-
-// this is fine for the same reason as `BAR`.
-static BOO: &mut Foo<()> = &mut Foo(());
-
-// interior mutability is fine
-struct Meh {
- x: &'static UnsafeCell<i32>,
-}
-unsafe impl Sync for Meh {}
-static MEH: Meh = Meh {
- x: &UnsafeCell::new(42),
-};
-
-// this is fine for the same reason as `BAR`.
-static OH_YES: &mut i32 = &mut 42;
-
-fn main() {
- unsafe {
- *MEH.x.get() = 99;
- }
- *OH_YES = 99; //~ ERROR cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
-}
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr
deleted file mode 100644
index 3ed96701a..000000000
--- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
- --> $DIR/mutable_references.rs:35:5
- |
-LL | *OH_YES = 99;
- | ^^^^^^^^^^^^ cannot assign
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references.rs:8:26
- |
-LL | static FOO: &&mut u32 = &&mut 42;
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references.rs:12:23
- |
-LL | static BAR: &mut () = &mut ();
- | ^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references.rs:17:28
- |
-LL | static BOO: &mut Foo<()> = &mut Foo(());
- | ^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references.rs:25:8
- |
-LL | x: &UnsafeCell::new(42),
- | ^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references.rs:29:27
- |
-LL | static OH_YES: &mut i32 = &mut 42;
- | ^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
deleted file mode 100644
index 0ea179240..000000000
--- a/src/test/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
+++ /dev/null
@@ -1,54 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:15:1
- |
-LL | const MUH: Meh = Meh {
- | ^^^^^^^^^^^^^^ constructing invalid value at .x.<deref>: encountered `UnsafeCell` in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc3──╼ │ ╾──╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:25:1
- |
-LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 4) {
- ╾─alloc7──╼ ╾─alloc8──╼ │ ╾──╼╾──╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:29:1
- |
-LL | const BLUNT: &mut i32 = &mut 42;
- | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 4, align: 4) {
- ╾─alloc10─╼ │ ╾──╼
- }
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:16:8
- |
-LL | x: &UnsafeCell::new(42),
- | ^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:25:27
- |
-LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:29:25
- |
-LL | const BLUNT: &mut i32 = &mut 42;
- | ^^^^^^^
-
-error: aborting due to 3 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
deleted file mode 100644
index 67959d256..000000000
--- a/src/test/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
+++ /dev/null
@@ -1,54 +0,0 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:15:1
- |
-LL | const MUH: Meh = Meh {
- | ^^^^^^^^^^^^^^ constructing invalid value at .x.<deref>: encountered `UnsafeCell` in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc3────────╼ │ ╾──────╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:25:1
- |
-LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 16, align: 8) {
- ╾───────alloc7────────╼ ╾───────alloc8────────╼ │ ╾──────╼╾──────╼
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/mutable_references_err.rs:29:1
- |
-LL | const BLUNT: &mut i32 = &mut 42;
- | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const`
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 8, align: 8) {
- ╾───────alloc10───────╼ │ ╾──────╼
- }
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:16:8
- |
-LL | x: &UnsafeCell::new(42),
- | ^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:25:27
- |
-LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-help: skipping check that does not even have a feature gate
- --> $DIR/mutable_references_err.rs:29:25
- |
-LL | const BLUNT: &mut i32 = &mut 42;
- | ^^^^^^^
-
-error: aborting due to 3 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_err.rs b/src/test/ui/consts/miri_unleashed/mutable_references_err.rs
deleted file mode 100644
index 6399b122b..000000000
--- a/src/test/ui/consts/miri_unleashed/mutable_references_err.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// stderr-per-bitwidth
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-use std::cell::UnsafeCell;
-
-// this test ensures that our mutability story is sound
-
-struct Meh {
- x: &'static UnsafeCell<i32>,
-}
-unsafe impl Sync for Meh {}
-
-// the following will never be ok! no interior mut behind consts, because
-// all allocs interned here will be marked immutable.
-const MUH: Meh = Meh { //~ ERROR: it is undefined behavior to use this value
- x: &UnsafeCell::new(42),
-};
-
-struct Synced {
- x: UnsafeCell<i32>,
-}
-unsafe impl Sync for Synced {}
-
-// Make sure we also catch this behind a type-erased `dyn Trait` reference.
-const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
-//~^ ERROR: it is undefined behavior to use this value
-
-// Make sure we also catch mutable references.
-const BLUNT: &mut i32 = &mut 42;
-//~^ ERROR: it is undefined behavior to use this value
-
-fn main() {
- unsafe {
- *MUH.x.get() = 99;
- }
-}
diff --git a/src/test/ui/consts/miri_unleashed/mutating_global.rs b/src/test/ui/consts/miri_unleashed/mutating_global.rs
deleted file mode 100644
index 231f4af0a..000000000
--- a/src/test/ui/consts/miri_unleashed/mutating_global.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-// Make sure we cannot mutate globals.
-
-static mut GLOBAL: i32 = 0;
-
-static MUTATING_GLOBAL: () = {
- unsafe {
- GLOBAL = 99
- //~^ ERROR could not evaluate static initializer
- //~| NOTE modifying a static's initial value
- }
-};
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/mutating_global.stderr b/src/test/ui/consts/miri_unleashed/mutating_global.stderr
deleted file mode 100644
index c8770c8d7..000000000
--- a/src/test/ui/consts/miri_unleashed/mutating_global.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/mutating_global.rs:9:9
- |
-LL | GLOBAL = 99
- | ^^^^^^^^^^^ modifying a static's initial value from another static's initializer
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.rs b/src/test/ui/consts/miri_unleashed/non_const_fn.rs
deleted file mode 100644
index 44ab60dca..000000000
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-// A test demonstrating that we prevent calling non-const fn during CTFE.
-
-fn foo() {}
-
-static C: () = foo();
-//~^ ERROR could not evaluate static initializer
-//~| NOTE calling non-const function `foo`
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
deleted file mode 100644
index 57836f796..000000000
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/non_const_fn.rs:7:16
- |
-LL | static C: () = foo();
- | ^^^^^ calling non-const function `foo`
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/non_const_fn.rs:7:16
- |
-LL | static C: () = foo();
- | ^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.rs b/src/test/ui/consts/miri_unleashed/ptr_arith.rs
deleted file mode 100644
index 4d12960b8..000000000
--- a/src/test/ui/consts/miri_unleashed/ptr_arith.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(core_intrinsics)]
-
-// During CTFE, we prevent pointer-to-int casts.
-// Pointer comparisons are prevented in the trait system.
-
-static PTR_INT_CAST: () = {
- let x = &0 as *const _ as usize;
- //~^ ERROR could not evaluate static initializer
- //~| exposing pointers
- let _v = x == x;
-};
-
-static PTR_INT_TRANSMUTE: () = unsafe {
- let x: usize = std::mem::transmute(&0);
- let _v = x + 0;
- //~^ ERROR could not evaluate static initializer
- //~| unable to turn pointer into raw bytes
-};
-
-// I'd love to test pointer comparison, but that is not possible since
-// their `PartialEq` impl is non-`const`.
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr
deleted file mode 100644
index 30fd3a55e..000000000
--- a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:8:13
- |
-LL | let x = &0 as *const _ as usize;
- | ^^^^^^^^^^^^^^^^^^^^^^^ exposing pointers is not possible at compile-time
-
-error[E0080]: could not evaluate static initializer
- --> $DIR/ptr_arith.rs:16:14
- |
-LL | let _v = x + 0;
- | ^ unable to turn pointer into raw bytes
- |
- = help: this code performed an operation that depends on the underlying bytes representing a pointer
- = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/ptr_arith.rs:8:13
- |
-LL | let x = &0 as *const _ as usize;
- | ^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs b/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs
deleted file mode 100644
index 5f8ec4e6e..000000000
--- a/src/test/ui/consts/miri_unleashed/raw_mutable_const.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-
-use std::cell::UnsafeCell;
-
-const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
-//~^ ERROR: untyped pointers are not allowed in constant
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr b/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr
deleted file mode 100644
index f8dc11d69..000000000
--- a/src/test/ui/consts/miri_unleashed/raw_mutable_const.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: untyped pointers are not allowed in constant
- --> $DIR/raw_mutable_const.rs:5:1
- |
-LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/raw_mutable_const.rs:5:38
- |
-LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
- | ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error; 1 warning emitted
-
diff --git a/src/test/ui/consts/miri_unleashed/slice_eq.rs b/src/test/ui/consts/miri_unleashed/slice_eq.rs
deleted file mode 100644
index 83e10bf12..000000000
--- a/src/test/ui/consts/miri_unleashed/slice_eq.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-// run-pass
-
-#![feature(const_raw_ptr_comparison)]
-
-const EMPTY_SLICE: &[i32] = &[];
-const EMPTY_EQ: Option<bool> = EMPTY_SLICE.as_ptr().guaranteed_eq(&[] as *const _);
-const EMPTY_EQ2: Option<bool> = EMPTY_SLICE.as_ptr().guaranteed_eq(&[1] as *const _);
-
-fn main() {
- assert!(EMPTY_EQ.is_none());
- assert!(EMPTY_EQ2.is_none());
-}
diff --git a/src/test/ui/consts/miri_unleashed/tls.rs b/src/test/ui/consts/miri_unleashed/tls.rs
deleted file mode 100644
index d06d7cf19..000000000
--- a/src/test/ui/consts/miri_unleashed/tls.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(thread_local)]
-
-use std::thread;
-
-#[thread_local]
-static A: u8 = 0;
-
-// Make sure we catch accessing thread-local storage.
-static TEST_BAD: () = {
- unsafe { let _val = A; }
- //~^ ERROR could not evaluate static initializer
- //~| NOTE cannot access thread local static
-};
-
-// Make sure we catch taking a reference to thread-local storage.
-static TEST_BAD_REF: () = {
- unsafe { let _val = &A; }
- //~^ ERROR could not evaluate static initializer
- //~| NOTE cannot access thread local static
-};
-
-fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/tls.stderr b/src/test/ui/consts/miri_unleashed/tls.stderr
deleted file mode 100644
index 7aaeadd04..000000000
--- a/src/test/ui/consts/miri_unleashed/tls.stderr
+++ /dev/null
@@ -1,28 +0,0 @@
-error[E0080]: could not evaluate static initializer
- --> $DIR/tls.rs:11:25
- |
-LL | unsafe { let _val = A; }
- | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A))
-
-error[E0080]: could not evaluate static initializer
- --> $DIR/tls.rs:18:26
- |
-LL | unsafe { let _val = &A; }
- | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A))
-
-warning: skipping const checks
- |
-help: skipping check that does not even have a feature gate
- --> $DIR/tls.rs:11:25
- |
-LL | unsafe { let _val = A; }
- | ^
-help: skipping check that does not even have a feature gate
- --> $DIR/tls.rs:18:26
- |
-LL | unsafe { let _val = &A; }
- | ^
-
-error: aborting due to 2 previous errors; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0080`.