Skip to content

Commit 2982ba5

Browse files
authored
Rollup merge of rust-lang#82258 - tmiasko:foreign-hir-stats, r=davidtwco
Implement -Z hir-stats for nested foreign items An attempt to compute HIR stats for crates with nested foreign items results in an ICE. ```rust fn main() { extern "C" { fn f(); } } ``` ``` thread 'rustc' panicked at 'visit_nested_xxx must be manually implemented in this visitor' ``` Provide required implementation of visitor method.
2 parents 547b3ad + bf09e04 commit 2982ba5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_passes/src/hir_stats.rs

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
114114
self.visit_impl_item(nested_impl_item)
115115
}
116116

117+
fn visit_nested_foreign_item(&mut self, id: hir::ForeignItemId) {
118+
let nested_foreign_item = self.krate.unwrap().foreign_item(id);
119+
self.visit_foreign_item(nested_foreign_item);
120+
}
121+
117122
fn visit_nested_body(&mut self, body_id: hir::BodyId) {
118123
let nested_body = self.krate.unwrap().body(body_id);
119124
self.visit_body(nested_body)

0 commit comments

Comments
 (0)