about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-05-02 13:19:24 +0200
committerRalf Jung <post@ralfj.de>2020-05-02 13:32:58 +0200
commit08ba0145c7801ac57f8ce0d50e9babd1bc7930bc (patch)
tree0c5c04053657c6fa5994990d64ee497fdd233b58 /src/test/ui
parentc7eb91652fd26ccee708720ffcaf30954ac43f82 (diff)
downloadrust-08ba0145c7801ac57f8ce0d50e9babd1bc7930bc.tar.gz
rust-08ba0145c7801ac57f8ce0d50e9babd1bc7930bc.zip
make sure the miri-unleash-flag is not used to circumvent feature gates
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.rs4
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr12
-rw-r--r--src/test/ui/consts/miri_unleashed/read_from_static.stderr8
-rw-r--r--src/test/ui/consts/read_from_static_mut_ref.rs (renamed from src/test/ui/consts/miri_unleashed/read_from_static.rs)3
4 files changed, 10 insertions, 17 deletions
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
index 7c8cdaec4a1..0203f13ef61 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
@@ -1,6 +1,8 @@
 // build-fail
 // compile-flags: -Zunleash-the-miri-inside-of-you -Zdeduplicate-diagnostics
 #![allow(const_err)]
+#![feature(const_raw_ptr_deref)] // FIXME: cannot remove because then rustc thinks there is no error
+#![crate_type = "lib"]
 
 use std::sync::atomic::AtomicUsize;
 use std::sync::atomic::Ordering;
@@ -24,7 +26,7 @@ static mut MUTABLE: u32 = 0;
 const READ_MUT: u32 = unsafe { MUTABLE };
 //~^ WARN skipping const checks
 
-fn main() {
+pub fn main() {
     MUTATE_INTERIOR_MUT;
     //~^ ERROR: erroneous constant used
     READ_INTERIOR_MUT;
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
index 7e049647cfd..322f98d5445 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
@@ -1,5 +1,5 @@
 warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:11:1
+  --> $DIR/const_refers_to_static.rs:13:1
    |
 LL | / const MUTATE_INTERIOR_MUT: usize = {
 LL | |
@@ -9,7 +9,7 @@ LL | | };
    | |__^
 
 warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:17:1
+  --> $DIR/const_refers_to_static.rs:19:1
    |
 LL | / const READ_INTERIOR_MUT: usize = {
 LL | |
@@ -19,25 +19,25 @@ LL | | };
    | |__^
 
 warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:24:1
+  --> $DIR/const_refers_to_static.rs:26:1
    |
 LL | const READ_MUT: u32 = unsafe { MUTABLE };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:28:5
+  --> $DIR/const_refers_to_static.rs:30:5
    |
 LL |     MUTATE_INTERIOR_MUT;
    |     ^^^^^^^^^^^^^^^^^^^ referenced constant has errors
 
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:30:5
+  --> $DIR/const_refers_to_static.rs:32:5
    |
 LL |     READ_INTERIOR_MUT;
    |     ^^^^^^^^^^^^^^^^^ referenced constant has errors
 
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:32:5
+  --> $DIR/const_refers_to_static.rs:34:5
    |
 LL |     READ_MUT;
    |     ^^^^^^^^ referenced constant has errors
diff --git a/src/test/ui/consts/miri_unleashed/read_from_static.stderr b/src/test/ui/consts/miri_unleashed/read_from_static.stderr
deleted file mode 100644
index 13646f09a00..00000000000
--- a/src/test/ui/consts/miri_unleashed/read_from_static.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-warning: skipping const checks
-  --> $DIR/read_from_static.rs:5:1
-   |
-LL | static OH_YES: &mut i32 = &mut 42;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/src/test/ui/consts/miri_unleashed/read_from_static.rs b/src/test/ui/consts/read_from_static_mut_ref.rs
index 4bb0edae5d7..c18227e0f55 100644
--- a/src/test/ui/consts/miri_unleashed/read_from_static.rs
+++ b/src/test/ui/consts/read_from_static_mut_ref.rs
@@ -1,9 +1,8 @@
 // run-pass
-// compile-flags: -Zunleash-the-miri-inside-of-you
+#![feature(const_mut_refs)]
 #![allow(const_err)]
 
 static OH_YES: &mut i32 = &mut 42;
-//~^ WARN skipping const checks
 
 fn main() {
     // Make sure `OH_YES` can be read.