File tree 4 files changed +18
-9
lines changed
src/test/ui/consts/miri_unleashed
4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 1
1
// compile-flags: -Zunleash-the-miri-inside-of-you
2
+ // normalize-stderr-test "alloc[0-9]+" -> "allocN"
2
3
3
4
#![ feature( const_raw_ptr_deref) ]
4
5
#![ feature( const_mut_refs) ]
5
- #![ deny( const_err) ] // FIXME: ICEs with allow! See #71316.
6
+ #![ deny( const_err) ] // The `allow` variant is tested by `mutable_const2`.
7
+ //~^ NOTE lint level
8
+ // Here we check that even though `MUTABLE_BEHIND_RAW` is created from a mutable
9
+ // allocation, we intern that allocation as *immutable* and reject writes to it.
10
+ // We avoid the `delay_span_bug` ICE by having compilation fail via the `deny` above.
6
11
7
12
use std:: cell:: UnsafeCell ;
8
13
9
14
// make sure we do not just intern this as mutable
10
15
const MUTABLE_BEHIND_RAW : * mut i32 = & UnsafeCell :: new ( 42 ) as * const _ as * mut _ ;
11
16
//~^ WARN: skipping const checks
12
17
13
- const MUTATING_BEHIND_RAW : ( ) = {
18
+ const MUTATING_BEHIND_RAW : ( ) = { //~ NOTE
14
19
// Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
15
20
unsafe {
16
21
* MUTABLE_BEHIND_RAW = 99 //~ ERROR any use of this value will cause an error
22
+ //~^ NOTE: which is read-only
23
+ // FIXME would be good to match more of the error message here, but looks like we
24
+ // normalize *after* checking the annoations here.
17
25
}
18
26
} ;
19
27
Original file line number Diff line number Diff line change 1
1
warning: skipping const checks
2
- --> $DIR/mutable_const.rs:10 :38
2
+ --> $DIR/mutable_const.rs:15 :38
3
3
|
4
4
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
5
5
| ^^^^^^^^^^^^^^^^^^^^
6
6
7
7
error: any use of this value will cause an error
8
- --> $DIR/mutable_const.rs:16 :9
8
+ --> $DIR/mutable_const.rs:21 :9
9
9
|
10
10
LL | / const MUTATING_BEHIND_RAW: () = {
11
11
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
12
12
LL | | unsafe {
13
13
LL | | *MUTABLE_BEHIND_RAW = 99
14
- | | ^^^^^^^^^^^^^^^^^^^^^^^^ writing to alloc2 which is read-only
14
+ | | ^^^^^^^^^^^^^^^^^^^^^^^^ writing to allocN which is read-only
15
+ ... |
15
16
LL | | }
16
17
LL | | };
17
18
| |__-
18
19
|
19
20
note: the lint level is defined here
20
- --> $DIR/mutable_const.rs:5 :9
21
+ --> $DIR/mutable_const.rs:6 :9
21
22
|
22
- LL | #![deny(const_err)] // FIXME: ICEs with allow! See #71316 .
23
+ LL | #![deny(const_err)] // The `allow` variant is tested by `mutable_const2` .
23
24
| ^^^^^^^^^
24
25
25
26
error: aborting due to previous error; 1 warning emitted
Original file line number Diff line number Diff line change 3
3
// rustc-env:RUST_BACKTRACE=0
4
4
// normalize-stderr-test "note: rustc 1.* running on .*" -> "note: rustc VERSION running on TARGET"
5
5
// normalize-stderr-test "note: compiler flags: .*" -> "note: compiler flags: FLAGS"
6
- // normalize-stderr-test "interpret/intern.rs:[0-9]* :[0-9]* " -> "interpret/intern.rs:LL:CC"
6
+ // normalize-stderr-test "interpret/intern.rs:[0-9]+ :[0-9]+ " -> "interpret/intern.rs:LL:CC"
7
7
8
8
#![ feature( const_raw_ptr_deref) ]
9
9
#![ feature( const_mut_refs) ]
Original file line number Diff line number Diff line change 3
3
// rustc-env:RUST_BACKTRACE=0
4
4
// normalize-stderr-test "note: rustc 1.* running on .*" -> "note: rustc VERSION running on TARGET"
5
5
// normalize-stderr-test "note: compiler flags: .*" -> "note: compiler flags: FLAGS"
6
- // normalize-stderr-test "interpret/intern.rs:[0-9]* :[0-9]* " -> "interpret/intern.rs:LL:CC"
6
+ // normalize-stderr-test "interpret/intern.rs:[0-9]+ :[0-9]+ " -> "interpret/intern.rs:LL:CC"
7
7
8
8
#![ allow( const_err) ]
9
9
You can’t perform that action at this time.
0 commit comments