remove ItemLikeVisitor impls in incremental, interface, metadata and symbol_mangling crates
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
parent
28aa2dd3b4
commit
0d01ee9558
5 changed files with 24 additions and 103 deletions
|
@ -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 };
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue