diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-06 19:04:15 -0400 | 
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-08 11:59:59 -0400 | 
| commit | 0baf85e8b6588ea24af710c981c91930e01f5a19 (patch) | |
| tree | dd8b7d16c9116b81bb9a977fddbaf5605782da99 /compiler/rustc_interface/src/proc_macro_decls.rs | |
| parent | b73b4de982a16e8819e804cb648ff3ea63d22028 (diff) | |
| download | rust-0baf85e8b6588ea24af710c981c91930e01f5a19.tar.gz rust-0baf85e8b6588ea24af710c981c91930e01f5a19.zip | |
remove some uses of visit_all_item_likes in incremental, metadata and interface crates
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_interface/src/proc_macro_decls.rs')
| -rw-r--r-- | compiler/rustc_interface/src/proc_macro_decls.rs | 9 | 
1 files changed, 8 insertions, 1 deletions
| diff --git a/compiler/rustc_interface/src/proc_macro_decls.rs b/compiler/rustc_interface/src/proc_macro_decls.rs index c0316ce58d2..d0b895643c5 100644 --- a/compiler/rustc_interface/src/proc_macro_decls.rs +++ b/compiler/rustc_interface/src/proc_macro_decls.rs @@ -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)) } | 
