Skip to content

Commit 9233a54

Browse files
committed
only print LEAK REPORT if there is a leak
1 parent a8430a4 commit 9233a54

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_mir/interpret/memory.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -752,12 +752,14 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
752752
}
753753

754754
pub fn leak_report(&self) -> usize {
755-
eprintln!("### LEAK REPORT ###");
756755
let leaks: Vec<_> = self.alloc_map.filter_map_collect(|&id, &(kind, _)| {
757756
if kind.may_leak() { None } else { Some(id) }
758757
});
759758
let n = leaks.len();
760-
self.dump_allocs(leaks);
759+
if n > 0 {
760+
eprintln!("### LEAK REPORT ###");
761+
self.dump_allocs(leaks);
762+
}
761763
n
762764
}
763765

0 commit comments

Comments
 (0)