use rustc_hir::def_id::LocalDefId;
use rustc_hir::definitions::*;
use rustc_span::hygiene::LocalExpnId;
-use rustc_span::symbol::{kw, sym};
+use rustc_span::symbol::sym;
use rustc_span::Span;
use tracing::debug;
// information we encapsulate into, the better
let def_data = match &i.kind {
ItemKind::Impl { .. } => DefPathData::Impl,
- ItemKind::Mod(..) if i.ident.name == kw::Empty => {
- // Fake crate root item from expand.
- return visit::walk_item(self, i);
- }
+ ItemKind::ForeignMod(..) => DefPathData::ForeignMod,
ItemKind::Mod(..)
| ItemKind::Trait(..)
| ItemKind::TraitAlias(..)
| ItemKind::Struct(..)
| ItemKind::Union(..)
| ItemKind::ExternCrate(..)
- | ItemKind::ForeignMod(..)
| ItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.name),
ItemKind::Static(..) | ItemKind::Const(..) | ItemKind::Fn(..) => {
DefPathData::ValueNs(i.ident.name)
fn visit_field_def(&mut self, field: &'a FieldDef) {
self.collect_field(field, None);
}
+
+ fn visit_crate(&mut self, krate: &'a Crate) {
+ if krate.is_placeholder {
+ self.visit_macro_invoc(krate.id)
+ } else {
+ visit::walk_crate(self, krate)
+ }
+ }
}