diff options
| author | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-07 12:29:57 -0400 |
|---|---|---|
| committer | Miguel Guarniz <mi9uel9@gmail.com> | 2022-04-08 12:00:23 -0400 |
| commit | 0d01ee95583479b5cbcffe183075c7943099192a (patch) | |
| tree | 13a361720b86f526d0b6376f210dc23a4839d5f4 /compiler/rustc_interface/src | |
| parent | 28aa2dd3b4295c64b8c38a7863bfaefd6790e6ef (diff) | |
| download | rust-0d01ee95583479b5cbcffe183075c7943099192a.tar.gz rust-0d01ee95583479b5cbcffe183075c7943099192a.zip | |
remove ItemLikeVisitor impls in incremental, interface, metadata and symbol_mangling crates
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/proc_macro_decls.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/compiler/rustc_interface/src/proc_macro_decls.rs b/compiler/rustc_interface/src/proc_macro_decls.rs index d0b895643c5..8652bd00fb7 100644 --- a/compiler/rustc_interface/src/proc_macro_decls.rs +++ b/compiler/rustc_interface/src/proc_macro_decls.rs @@ -1,6 +1,5 @@ use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; -use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_middle::ty::query::Providers; use rustc_middle::ty::TyCtxt; use rustc_span::symbol::sym; @@ -9,10 +8,9 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> { let mut finder = Finder { tcx, decls: None }; for id in tcx.hir().items() { - let item = tcx.hir().item(id); - let attrs = finder.tcx.hir().attrs(item.hir_id()); + let attrs = finder.tcx.hir().attrs(id.hir_id()); if finder.tcx.sess.contains_name(attrs, sym::rustc_proc_macro_decls) { - finder.decls = Some(item.hir_id()); + finder.decls = Some(id.hir_id()); } } @@ -24,21 +22,6 @@ struct Finder<'tcx> { decls: Option<hir::HirId>, } -impl<'v> ItemLikeVisitor<'v> for Finder<'_> { - fn visit_item(&mut self, item: &hir::Item<'_>) { - let attrs = self.tcx.hir().attrs(item.hir_id()); - if self.tcx.sess.contains_name(attrs, sym::rustc_proc_macro_decls) { - self.decls = Some(item.hir_id()); - } - } - - fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem<'_>) {} - - fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem<'_>) {} - - fn visit_foreign_item(&mut self, _foreign_item: &hir::ForeignItem<'_>) {} -} - pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { proc_macro_decls_static, ..*providers }; } |
