Skip to content

Commit

Permalink
only print LEAK REPORT if there is a leak
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 23, 2019
1 parent a8430a4 commit 9233a54
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,14 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
}

pub fn leak_report(&self) -> usize {
eprintln!("### LEAK REPORT ###");
let leaks: Vec<_> = self.alloc_map.filter_map_collect(|&id, &(kind, _)| {
if kind.may_leak() { None } else { Some(id) }
});
let n = leaks.len();
self.dump_allocs(leaks);
if n > 0 {
eprintln!("### LEAK REPORT ###");
self.dump_allocs(leaks);
}
n
}

Expand Down

0 comments on commit 9233a54

Please sign in to comment.