Rollup merge of #43824 - kennytm:fix-43232-hir-stats, r=petrochenkov

Fix `-Z hir-stats` always panics.

Fix #43232.
This commit is contained in:
Guillaume Gomez 2017-08-13 11:03:14 +02:00 committed by GitHub
commit 09ac9fd272

View File

@ -125,6 +125,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
self.visit_impl_item(nested_impl_item) self.visit_impl_item(nested_impl_item)
} }
fn visit_nested_body(&mut self, body_id: hir::BodyId) {
let nested_body = self.krate.unwrap().body(body_id);
self.visit_body(nested_body)
}
fn visit_item(&mut self, i: &'v hir::Item) { fn visit_item(&mut self, i: &'v hir::Item) {
self.record("Item", Id::Node(i.id), i); self.record("Item", Id::Node(i.id), i);
hir_visit::walk_item(self, i) hir_visit::walk_item(self, i)