File tree 2 files changed +25
-0
lines changed
src/tools/miri/tests/fail
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ // This should fail even without validation
2
+ //@compile-flags: -Zmiri-disable-validation
3
+
4
+ #![ feature( never_type) ]
5
+ #![ allow( unreachable_code) ]
6
+
7
+ fn main ( ) {
8
+ let ptr: * const ( i32 , !) = & 0i32 as * const i32 as * const _ ;
9
+ unsafe { match ( * ptr) . 1 { } } //~ ERROR: entering unreachable code
10
+ }
Original file line number Diff line number Diff line change
1
+ error: Undefined Behavior: entering unreachable code
2
+ --> $DIR/never_match_never.rs:LL:CC
3
+ |
4
+ LL | unsafe { match (*ptr).1 {} }
5
+ | ^^^^^^^^ entering unreachable code
6
+ |
7
+ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
8
+ = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
9
+ = note: BACKTRACE:
10
+ = note: inside `main` at $DIR/never_match_never.rs:LL:CC
11
+
12
+ note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
13
+
14
+ error: aborting due to previous error
15
+
You can’t perform that action at this time.
0 commit comments