File tree Expand file tree Collapse file tree 4 files changed +6
-53
lines changed
src/test/ui/consts/miri_unleashed Expand file tree Collapse file tree 4 files changed +6
-53
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,7 @@ const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
1212const MUTATING_BEHIND_RAW : ( ) = {
1313 // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
1414 unsafe {
15- * MUTABLE_BEHIND_RAW = 99 //~ WARN skipping const checks
16- //~^ ERROR any use of this value will cause an error
17- //~^^ tried to modify constant memory
15+ * MUTABLE_BEHIND_RAW = 99 //~ ERROR constant contains unimplemented expression type
1816 }
1917} ;
2018
Original file line number Diff line number Diff line change @@ -4,30 +4,12 @@ warning: skipping const checks
44LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
55 | ^^^^^^^^^^^^^^^^^^^^
66
7- warning: skipping const checks
7+ error[E0019]: constant contains unimplemented expression type
88 --> $DIR/mutable_const.rs:15:9
99 |
1010LL | *MUTABLE_BEHIND_RAW = 99
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^
1212
13- error: any use of this value will cause an error
14- --> $DIR/mutable_const.rs:15:9
15- |
16- LL | / const MUTATING_BEHIND_RAW: () = {
17- LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
18- LL | | unsafe {
19- LL | | *MUTABLE_BEHIND_RAW = 99
20- | | ^^^^^^^^^^^^^^^^^^^^^^^^ tried to modify constant memory
21- ... |
22- LL | | }
23- LL | | };
24- | |__-
25- |
26- note: lint level defined here
27- --> $DIR/mutable_const.rs:4:9
28- |
29- LL | #![deny(const_err)]
30- | ^^^^^^^^^
31-
3213error: aborting due to previous error
3314
15+ For more information about this error, try `rustc --explain E0019`.
Original file line number Diff line number Diff line change 11// compile-flags: -Zunleash-the-miri-inside-of-you
2+ #![ feature( const_mut_refs) ]
23#![ allow( const_err) ]
34
45use std:: cell:: UnsafeCell ;
56
67// a test demonstrating what things we could allow with a smarter const qualification
78
89static FOO : & & mut u32 = & & mut 42 ;
9- //~^ WARN: skipping const checks
1010
1111static BAR : & mut ( ) = & mut ( ) ;
12- //~^ WARN: skipping const checks
1312
1413struct Foo < T > ( T ) ;
1514
1615static BOO : & mut Foo < ( ) > = & mut Foo ( ( ) ) ;
17- //~^ WARN: skipping const checks
1816
1917struct Meh {
2018 x : & ' static UnsafeCell < i32 > ,
@@ -28,7 +26,6 @@ static MEH: Meh = Meh {
2826} ;
2927
3028static OH_YES : & mut i32 = & mut 42 ;
31- //~^ WARN: skipping const checks
3229
3330fn main ( ) {
3431 unsafe {
Original file line number Diff line number Diff line change 11warning: skipping const checks
2- --> $DIR/mutable_references.rs:8:26
3- |
4- LL | static FOO: &&mut u32 = &&mut 42;
5- | ^^^^^^^
6-
7- warning: skipping const checks
8- --> $DIR/mutable_references.rs:11:23
9- |
10- LL | static BAR: &mut () = &mut ();
11- | ^^^^^^^
12-
13- warning: skipping const checks
14- --> $DIR/mutable_references.rs:16:28
15- |
16- LL | static BOO: &mut Foo<()> = &mut Foo(());
17- | ^^^^^^^^^^^^
18-
19- warning: skipping const checks
20- --> $DIR/mutable_references.rs:26:8
2+ --> $DIR/mutable_references.rs:24:8
213 |
224LL | x: &UnsafeCell::new(42),
235 | ^^^^^^^^^^^^^^^^^^^^
246
25- warning: skipping const checks
26- --> $DIR/mutable_references.rs:30:27
27- |
28- LL | static OH_YES: &mut i32 = &mut 42;
29- | ^^^^^^^
30-
317error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
32- --> $DIR/mutable_references.rs:37 :5
8+ --> $DIR/mutable_references.rs:34 :5
339 |
3410LL | *OH_YES = 99;
3511 | ^^^^^^^^^^^^ cannot assign
You can’t perform that action at this time.
0 commit comments