Skip to content

Commit a04620e

Browse files
committed
only run leak test on clean platforms
1 parent fbc1fb2 commit a04620e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/eval.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,18 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) ->
201201
// Process the result.
202202
match res {
203203
Ok(return_code) => {
204-
let leaks = ecx.memory.leak_report();
205204
// Disable the leak test on some platforms where we do not
206205
// correctly implement TLS destructors.
207206
let target_os = ecx.tcx.tcx.sess.target.target.target_os.to_lowercase();
208207
let ignore_leaks = target_os == "windows" || target_os == "macos";
209-
if !ignore_leaks && leaks != 0 {
210-
tcx.sess.err("the evaluated program leaked memory");
211-
// Ignore the provided return code - let the reported error
212-
// determine the return code.
213-
return None;
208+
if !ignore_leaks {
209+
let leaks = ecx.memory.leak_report();
210+
if leaks != 0 {
211+
tcx.sess.err("the evaluated program leaked memory");
212+
// Ignore the provided return code - let the reported error
213+
// determine the return code.
214+
return None;
215+
}
214216
}
215217
return Some(return_code)
216218
}

0 commit comments

Comments
 (0)