diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.rs b/src/test/ui/consts/miri_unleashed/mutable_const.rs index 44b408494679..cf5e6d600258 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_const.rs @@ -12,9 +12,7 @@ const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; const MUTATING_BEHIND_RAW: () = { // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. unsafe { - *MUTABLE_BEHIND_RAW = 99 //~ WARN skipping const checks - //~^ ERROR any use of this value will cause an error - //~^^ tried to modify constant memory + *MUTABLE_BEHIND_RAW = 99 //~ ERROR constant contains unimplemented expression type } }; diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.stderr b/src/test/ui/consts/miri_unleashed/mutable_const.stderr index 757f0ffb59ff..1a18063625be 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_const.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_const.stderr @@ -4,30 +4,12 @@ warning: skipping const checks LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^ -warning: skipping const checks +error[E0019]: constant contains unimplemented expression type --> $DIR/mutable_const.rs:15:9 | LL | *MUTABLE_BEHIND_RAW = 99 | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: any use of this value will cause an error - --> $DIR/mutable_const.rs:15:9 - | -LL | / const MUTATING_BEHIND_RAW: () = { -LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time. -LL | | unsafe { -LL | | *MUTABLE_BEHIND_RAW = 99 - | | ^^^^^^^^^^^^^^^^^^^^^^^^ tried to modify constant memory -... | -LL | | } -LL | | }; - | |__- - | -note: lint level defined here - --> $DIR/mutable_const.rs:4:9 - | -LL | #![deny(const_err)] - | ^^^^^^^^^ - error: aborting due to previous error +For more information about this error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs index 59dafcbf4d50..d95833e3071d 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.rs +++ b/src/test/ui/consts/miri_unleashed/mutable_references.rs @@ -1,4 +1,5 @@ // compile-flags: -Zunleash-the-miri-inside-of-you +#![feature(const_mut_refs)] #![allow(const_err)] use std::cell::UnsafeCell; @@ -6,15 +7,12 @@ use std::cell::UnsafeCell; // a test demonstrating what things we could allow with a smarter const qualification static FOO: &&mut u32 = &&mut 42; -//~^ WARN: skipping const checks static BAR: &mut () = &mut (); -//~^ WARN: skipping const checks struct Foo(T); static BOO: &mut Foo<()> = &mut Foo(()); -//~^ WARN: skipping const checks struct Meh { x: &'static UnsafeCell, @@ -28,7 +26,6 @@ static MEH: Meh = Meh { }; static OH_YES: &mut i32 = &mut 42; -//~^ WARN: skipping const checks fn main() { unsafe { diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr index b9c0af33c39c..ce1f5f38dd99 100644 --- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr +++ b/src/test/ui/consts/miri_unleashed/mutable_references.stderr @@ -1,35 +1,11 @@ warning: skipping const checks - --> $DIR/mutable_references.rs:8:26 - | -LL | static FOO: &&mut u32 = &&mut 42; - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:11:23 - | -LL | static BAR: &mut () = &mut (); - | ^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:16:28 - | -LL | static BOO: &mut Foo<()> = &mut Foo(()); - | ^^^^^^^^^^^^ - -warning: skipping const checks - --> $DIR/mutable_references.rs:26:8 + --> $DIR/mutable_references.rs:24:8 | LL | x: &UnsafeCell::new(42), | ^^^^^^^^^^^^^^^^^^^^ -warning: skipping const checks - --> $DIR/mutable_references.rs:30:27 - | -LL | static OH_YES: &mut i32 = &mut 42; - | ^^^^^^^ - error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item - --> $DIR/mutable_references.rs:37:5 + --> $DIR/mutable_references.rs:34:5 | LL | *OH_YES = 99; | ^^^^^^^^^^^^ cannot assign