Skip to content

Commit 76034a6

Browse files
committed
do not run EnvVars::cleanup if there was an interpreter error
1 parent 7310925 commit 76034a6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/tools/miri/src/eval.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,13 @@ pub fn eval_entry<'tcx>(
459459
ecx.handle_ice();
460460
panic::resume_unwind(panic_payload)
461461
});
462-
// `Ok` can never happen.
462+
// `Ok` can never happen; the interpreter loop always exits with an "error"
463+
// (but that "error" might be just "regular program termination").
463464
let Err(err) = res.report_err();
465+
// Show diagnostic, if any.
466+
let (return_code, leak_check) = report_error(&ecx, err)?;
467+
468+
// If we get here there was no fatal error.
464469

465470
// Machine cleanup. Only do this if all threads have terminated; threads that are still running
466471
// might cause Stacked Borrows errors (https://github.com/rust-lang/miri/issues/2396).
@@ -472,8 +477,7 @@ pub fn eval_entry<'tcx>(
472477
EnvVars::cleanup(&mut ecx).expect("error during env var cleanup");
473478
}
474479

475-
// Process the result.
476-
let (return_code, leak_check) = report_error(&ecx, err)?;
480+
// Possibly check for memory leaks.
477481
if leak_check && !ignore_leaks {
478482
// Check for thread leaks.
479483
if !ecx.have_all_terminated() {

0 commit comments

Comments
 (0)