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 _;
12
12
const MUTATING_BEHIND_RAW : ( ) = {
13
13
// Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
14
14
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
18
16
}
19
17
} ;
20
18
Original file line number Diff line number Diff line change @@ -4,30 +4,12 @@ warning: skipping const checks
4
4
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
5
5
| ^^^^^^^^^^^^^^^^^^^^
6
6
7
- warning: skipping const checks
7
+ error[E0019]: constant contains unimplemented expression type
8
8
--> $DIR/mutable_const.rs:15:9
9
9
|
10
10
LL | *MUTABLE_BEHIND_RAW = 99
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^
12
12
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
-
32
13
error: aborting due to previous error
33
14
15
+ For more information about this error, try `rustc --explain E0019`.
Original file line number Diff line number Diff line change 1
1
// compile-flags: -Zunleash-the-miri-inside-of-you
2
+ #![ feature( const_mut_refs) ]
2
3
#![ allow( const_err) ]
3
4
4
5
use std:: cell:: UnsafeCell ;
5
6
6
7
// a test demonstrating what things we could allow with a smarter const qualification
7
8
8
9
static FOO : & & mut u32 = & & mut 42 ;
9
- //~^ WARN: skipping const checks
10
10
11
11
static BAR : & mut ( ) = & mut ( ) ;
12
- //~^ WARN: skipping const checks
13
12
14
13
struct Foo < T > ( T ) ;
15
14
16
15
static BOO : & mut Foo < ( ) > = & mut Foo ( ( ) ) ;
17
- //~^ WARN: skipping const checks
18
16
19
17
struct Meh {
20
18
x : & ' static UnsafeCell < i32 > ,
@@ -28,7 +26,6 @@ static MEH: Meh = Meh {
28
26
} ;
29
27
30
28
static OH_YES : & mut i32 = & mut 42 ;
31
- //~^ WARN: skipping const checks
32
29
33
30
fn main ( ) {
34
31
unsafe {
Original file line number Diff line number Diff line change 1
1
warning: 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
21
3
|
22
4
LL | x: &UnsafeCell::new(42),
23
5
| ^^^^^^^^^^^^^^^^^^^^
24
6
25
- warning: skipping const checks
26
- --> $DIR/mutable_references.rs:30:27
27
- |
28
- LL | static OH_YES: &mut i32 = &mut 42;
29
- | ^^^^^^^
30
-
31
7
error[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
33
9
|
34
10
LL | *OH_YES = 99;
35
11
| ^^^^^^^^^^^^ cannot assign
You can’t perform that action at this time.
0 commit comments