make sure the miri-unleash-flag is not used to circumvent feature gates

This commit is contained in:
Ralf Jung 2020-05-02 13:19:24 +02:00
parent c7eb91652f
commit 08ba0145c7
6 changed files with 49 additions and 18 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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.