remove some uses of visit_all_item_likes in incremental, metadata and interface crates

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
Miguel Guarniz 2022-04-06 19:04:15 -04:00
parent b73b4de982
commit 0baf85e8b6
6 changed files with 64 additions and 7 deletions

View file

@ -7,7 +7,14 @@ use rustc_span::symbol::sym;
fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
let mut finder = Finder { tcx, decls: None };
tcx.hir().visit_all_item_likes(&mut finder);
for id in tcx.hir().items() {
let item = tcx.hir().item(id);
let attrs = finder.tcx.hir().attrs(item.hir_id());
if finder.tcx.sess.contains_name(attrs, sym::rustc_proc_macro_decls) {
finder.decls = Some(item.hir_id());
}
}
finder.decls.map(|id| tcx.hir().local_def_id(id))
}