Skip to content

Commit 681690d

Browse files
committed
Update miri_unleashed tests
1 parent 683f5c9 commit 681690d

File tree

4 files changed

+6
-53
lines changed

4 files changed

+6
-53
lines changed

src/test/ui/consts/miri_unleashed/mutable_const.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
1212
const 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

src/test/ui/consts/miri_unleashed/mutable_const.stderr

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,12 @@ warning: skipping const checks
44
LL | 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
|
1010
LL | *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-
3213
error: aborting due to previous error
3314

15+
For more information about this error, try `rustc --explain E0019`.

src/test/ui/consts/miri_unleashed/mutable_references.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
// compile-flags: -Zunleash-the-miri-inside-of-you
2+
#![feature(const_mut_refs)]
23
#![allow(const_err)]
34

45
use std::cell::UnsafeCell;
56

67
// a test demonstrating what things we could allow with a smarter const qualification
78

89
static FOO: &&mut u32 = &&mut 42;
9-
//~^ WARN: skipping const checks
1010

1111
static BAR: &mut () = &mut ();
12-
//~^ WARN: skipping const checks
1312

1413
struct Foo<T>(T);
1514

1615
static BOO: &mut Foo<()> = &mut Foo(());
17-
//~^ WARN: skipping const checks
1816

1917
struct Meh {
2018
x: &'static UnsafeCell<i32>,
@@ -28,7 +26,6 @@ static MEH: Meh = Meh {
2826
};
2927

3028
static OH_YES: &mut i32 = &mut 42;
31-
//~^ WARN: skipping const checks
3229

3330
fn main() {
3431
unsafe {

src/test/ui/consts/miri_unleashed/mutable_references.stderr

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
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
213
|
224
LL | 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-
317
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
339
|
3410
LL | *OH_YES = 99;
3511
| ^^^^^^^^^^^^ cannot assign

0 commit comments

Comments
 (0)