This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
src/tools/miri/tests/panic Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ //! Ensure that the MIR validator runs on Miri's input.
2+ //@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
3+ //@normalize-stderr-test: "\n +at [^\n]+" -> ""
4+ //@normalize-stderr-test: "\n +\[\.\.\. omitted [0-9]+ frames? \.\.\.\]" -> ""
5+ //@normalize-stderr-test: "\n[ =]*note:.*" -> ""
6+ #![ feature( custom_mir, core_intrinsics) ]
7+ use core:: intrinsics:: mir:: * ;
8+
9+ #[ custom_mir( dialect = "runtime" , phase = "optimized" ) ]
10+ pub fn main ( ) {
11+ mir ! {
12+ let x: i32 ;
13+ let tuple: ( * mut i32 , ) ;
14+ {
15+ tuple. 0 = core:: ptr:: addr_of_mut!( x) ;
16+ // Deref at the wrong place!
17+ * ( tuple. 0 ) = 1 ;
18+ Return ( )
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ thread 'rustc' panicked at compiler/rustc_const_eval/src/transform/validate.rs:LL:CC:
2+ broken MIR in Item(DefId(0:4 ~ mir_validation[fad2]::main)) (after phase change to runtime-optimized) at bb0[1]:
3+ (*(_2.0: *mut i32)), has deref at the wrong place
4+ stack backtrace:
5+
6+ error: the compiler unexpectedly panicked. this is a bug.
7+
8+
9+
10+
11+ query stack during panic:
12+ #0 [optimized_mir] optimizing MIR for `main`
13+ end of query stack
14+
15+ Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
16+ --> RUSTLIB/core/src/ops/function.rs:LL:CC
17+ |
18+ LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
19+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+ |
21+
You can’t perform that action at this time.
0 commit comments