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
|
@ -3,7 +3,7 @@ use rustc_attr as attr;
|
|||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::struct_span_err;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::ty::{List, ParamEnv, ParamEnvAnd, Ty, TyCtxt};
|
||||
use rustc_session::cstore::{DllCallingConvention, DllImport, NativeLib};
|
||||
use rustc_session::parse::feature_err;
|
||||
|
@ -16,8 +16,7 @@ use rustc_target::spec::abi::Abi;
|
|||
crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLib> {
|
||||
let mut collector = Collector { tcx, libs: Vec::new() };
|
||||
for id in tcx.hir().items() {
|
||||
let item = tcx.hir().item(id);
|
||||
collector.visit_item(item);
|
||||
collector.process_item(id);
|
||||
}
|
||||
collector.process_command_line();
|
||||
collector.libs
|
||||
|
@ -35,8 +34,13 @@ struct Collector<'tcx> {
|
|||
libs: Vec<NativeLib>,
|
||||
}
|
||||
|
||||
impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
||||
fn visit_item(&mut self, it: &'tcx hir::Item<'tcx>) {
|
||||
impl<'tcx> Collector<'tcx> {
|
||||
fn process_item(&mut self, id: rustc_hir::ItemId) {
|
||||
if !matches!(self.tcx.hir().def_kind(id.def_id), DefKind::ForeignMod) {
|
||||
return;
|
||||
}
|
||||
|
||||
let it = self.tcx.hir().item(id);
|
||||
let hir::ItemKind::ForeignMod { abi, items: foreign_mod_items } = it.kind else {
|
||||
return;
|
||||
};
|
||||
|
@ -255,12 +259,6 @@ impl<'tcx> ItemLikeVisitor<'tcx> for Collector<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, _it: &'tcx hir::TraitItem<'tcx>) {}
|
||||
fn visit_impl_item(&mut self, _it: &'tcx hir::ImplItem<'tcx>) {}
|
||||
fn visit_foreign_item(&mut self, _it: &'tcx hir::ForeignItem<'tcx>) {}
|
||||
}
|
||||
|
||||
impl Collector<'_> {
|
||||
fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
|
||||
if lib.name.as_ref().map_or(false, |&s| s == kw::Empty) {
|
||||
match span {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue