Drop walk_crate_and_attributes.
This commit is contained in:
parent
bd2f08c22f
commit
df148e4efb
4 changed files with 10 additions and 20 deletions
|
@ -11,6 +11,10 @@ use rustc_middle::ty::TyCtxt;
|
|||
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||
tcx.dep_graph.assert_ignored();
|
||||
|
||||
if tcx.sess.opts.debugging_opts.hir_stats {
|
||||
crate::hir_stats::print_hir_stats(tcx);
|
||||
}
|
||||
|
||||
let errors = Lock::new(Vec::new());
|
||||
let hir_map = tcx.hir();
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use rustc_hir as hir;
|
|||
use rustc_hir::intravisit as hir_visit;
|
||||
use rustc_hir::HirId;
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_middle::util::common::to_readable_str;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -25,18 +26,19 @@ struct NodeData {
|
|||
}
|
||||
|
||||
struct StatCollector<'k> {
|
||||
krate: Option<&'k hir::Crate<'k>>,
|
||||
krate: Option<Map<'k>>,
|
||||
data: FxHashMap<&'static str, NodeData>,
|
||||
seen: FxHashSet<Id>,
|
||||
}
|
||||
|
||||
pub fn print_hir_stats(krate: &hir::Crate<'_>) {
|
||||
pub fn print_hir_stats(tcx: TyCtxt<'_>) {
|
||||
let mut collector = StatCollector {
|
||||
krate: Some(krate),
|
||||
krate: Some(tcx.hir()),
|
||||
data: FxHashMap::default(),
|
||||
seen: FxHashSet::default(),
|
||||
};
|
||||
hir_visit::walk_crate_and_attributes(&mut collector, krate);
|
||||
tcx.hir().walk_crate(&mut collector);
|
||||
tcx.hir().walk_attributes(&mut collector);
|
||||
collector.print("HIR STATS");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue