diff options
| -rw-r--r-- | src/librustc_mir/interpret/memory.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index c8777bb9a98..d9226e7464b 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -584,10 +584,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { pub fn leak_report(&self) -> usize { trace!("### LEAK REPORT ###"); - let static_kind = M::STATIC_KIND.map(|k| MemoryKind::Machine(k)); - let leaks: Vec<_> = self.alloc_map.filter_map_collect(|&id, &(kind, _)| - // exclude mutable statics - if Some(kind) == static_kind { None } else { Some(id) } ); + let leaks: Vec<_> = self.alloc_map.filter_map_collect(|&id, &(kind, _)| { + // exclude statics and vtables + let exclude = match kind { + MemoryKind::Stack => false, + MemoryKind::Vtable => true, + MemoryKind::Machine(k) => Some(k) == M::STATIC_KIND, + }; + if exclude { None } else { Some(id) } + }); let n = leaks.len(); self.dump_allocs(leaks); n |
