Skip to content

Commit 58d5c30

Browse files
committed
Flush delayed bugs when exiting miri.
1 parent 8a25163 commit 58d5c30

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/tools/miri/src/bin/miri.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,13 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
329329
}
330330

331331
fn exit(exit_code: i32) -> ! {
332+
// MIR validation uses delayed bugs. Flush them as we won't return for `run_compiler` to do it.
333+
ty::tls::with_opt(|opt_tcx| {
334+
if let Some(tcx) = opt_tcx {
335+
tcx.dcx().flush_delayed()
336+
}
337+
});
338+
332339
// Drop the tracing guard before exiting, so tracing calls are flushed correctly.
333340
deinit_loggers();
334341
// Make sure the supervisor knows about the exit code.
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
1-
error: internal compiler error: compiler/rustc_mir_transform/src/validate.rs:LL:CC: broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
1+
note: no errors encountered even though delayed bugs were created
2+
3+
4+
error: internal compiler error: broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]:
25
place (*(_2.0: *mut i32)) has deref as a later projection (it is only permitted as the first projection)
36
--> tests/panic/mir-validation.rs:LL:CC
47
|
58
LL | *(tuple.0) = 1;
69
| ^^^^^^^^^^^^^^
7-
8-
9-
thread 'rustc' ($TID) panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC:
10-
Box<dyn Any>
11-
stack backtrace:
10+
|
11+
12+
--> tests/panic/mir-validation.rs:LL:CC
13+
|
14+
LL | *(tuple.0) = 1;
15+
| ^^^^^^^^^^^^^^
1216

1317

1418

1519

1620
query stack during panic:
17-
#0 [optimized_mir] optimizing MIR for `main`
1821
end of query stack
19-
20-
Miri caused an ICE during evaluation. Here's the interpreter backtrace at the time of the panic:
21-
--> RUSTLIB/core/src/ops/function.rs:LL:CC
22-
|
23-
LL | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25-
|
26-
2722
error: aborting due to 1 previous error
2823

0 commit comments

Comments
 (0)