Skip to content

Commit 0303d8e

Browse files
committed
stronger normalization of mir-validation ICE
1 parent 61a7d3d commit 0303d8e

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

src/tools/miri/src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pub fn report_error<'tcx, 'mir>(
291291
ValidationErrorKind::PointerAsInt { .. } | ValidationErrorKind::PartialPointer
292292
) =>
293293
{
294-
ecx.handle_ice(); // print interpreter backtrace
294+
ecx.handle_ice(); // print interpreter backtrace (this is outside the eval `catch_unwind`)
295295
bug!(
296296
"This validation error should be impossible in Miri: {}",
297297
format_interp_error(ecx.tcx.dcx(), e)
@@ -308,7 +308,7 @@ pub fn report_error<'tcx, 'mir>(
308308
InvalidProgramInfo::AlreadyReported(_) | InvalidProgramInfo::Layout(..),
309309
) => "post-monomorphization error",
310310
_ => {
311-
ecx.handle_ice(); // print interpreter backtrace
311+
ecx.handle_ice(); // print interpreter backtrace (this is outside the eval `catch_unwind`)
312312
bug!(
313313
"This error should be impossible in Miri: {}",
314314
format_interp_error(ecx.tcx.dcx(), e)

src/tools/miri/tests/panic/mir-validation.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
//! Ensure that the MIR validator runs on Miri's input.
22
//@rustc-env:RUSTC_ICE=0
3-
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> ""
4-
//@normalize-stderr-test: "\n +at [^\n]+" -> ""
5-
//@normalize-stderr-test: "\n +\[\.\.\. omitted [0-9]+ frames? \.\.\.\]" -> ""
3+
//@normalize-stderr-test: "\n +[0-9]+:.+" -> ""
4+
//@normalize-stderr-test: "\n +at .+" -> ""
5+
//@normalize-stderr-test: "\n +\[\.\.\. omitted [0-9]+ frames? \.\.\.\].*" -> ""
66
//@normalize-stderr-test: "\n[ =]*note:.*" -> ""
77
//@normalize-stderr-test: "DefId\([^()]*\)" -> "DefId"
8+
// Somehow on rustc Windows CI, the "Miri caused an ICE" message is not shown.
9+
//@normalize-stderr-test: "\nMiri caused an ICE .*" -> ""
10+
//@normalize-stderr-test: "\n *--> .*" -> ""
11+
//@normalize-stderr-test: "\n(LL)? +\|.*" -> ""
12+
//@normalize-stderr-test: "\n(\n)+" -> "$1"
813
#![feature(custom_mir, core_intrinsics)]
914
use core::intrinsics::mir::*;
1015

src/tools/miri/tests/panic/mir-validation.stderr

-13
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,7 @@ thread 'rustc' panicked at compiler/rustc_const_eval/src/transform/validate.rs:L
22
broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
33
(*(_2.0: *mut i32)), has deref at the wrong place
44
stack backtrace:
5-
65
error: the compiler unexpectedly panicked. this is a bug.
7-
8-
9-
10-
116
query stack during panic:
127
#0 [optimized_mir] optimizing MIR for `main`
138
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-

0 commit comments

Comments
 (0)