File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed 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[ =]*note:.*" -> ""
5
+ #![ feature( custom_mir, core_intrinsics) ]
6
+ use core:: intrinsics:: mir:: * ;
7
+
8
+ #[ custom_mir( dialect = "runtime" , phase = "optimized" ) ]
9
+ pub fn main ( ) {
10
+ mir ! {
11
+ let x: i32 ;
12
+ let tuple: ( * mut i32 , ) ;
13
+ {
14
+ tuple. 0 = core:: ptr:: addr_of_mut!( x) ;
15
+ // Deref at the wrong place!
16
+ * ( tuple. 0 ) = 1 ;
17
+ Return ( )
18
+ }
19
+ }
20
+ }
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
+ [... omitted 1 frame ...]
6
+
7
+ error: the compiler unexpectedly panicked. this is a bug.
8
+
9
+
10
+
11
+
12
+ query stack during panic:
13
+ #0 [optimized_mir] optimizing MIR for `main`
14
+ end of query stack
15
+
16
+ Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
17
+ --> RUSTLIB/core/src/ops/function.rs:LL:CC
18
+ |
19
+ LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
20
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21
+ |
22
+
You can’t perform that action at this time.
0 commit comments