UNUSED_IMPORTS,
};
use rustc::hir::def_id::{CrateNum, DefId};
-use rustc::hir::def::{self, PathResolution, Export};
+use rustc::hir::def::{self, DefKind, PathResolution, Export};
use rustc::session::DiagnosticMessageId;
use rustc::util::nodemap::FxHashSet;
use rustc::{bug, span_bug};
let dummy_binding = self.import(dummy_binding, directive);
self.per_ns(|this, ns| {
let _ = this.try_define(directive.parent_scope.module, target, ns, dummy_binding);
+ // Consider erroneous imports used to avoid duplicate diagnostics.
+ this.record_use(target, ns, dummy_binding, false);
});
}
}
// purposes it's good enough to just favor one over the other.
self.per_ns(|this, ns| if let Some(binding) = source_bindings[ns].get().ok() {
let mut def = binding.def();
- if let Def::Macro(def_id, _) = def {
+ if let Def::Def(DefKind::Macro(_), def_id) = def {
// `DefId`s from the "built-in macro crate" should not leak from resolve because
// later stages are not ready to deal with them and produce lots of ICEs. Replace
// them with `Def::Err` until some saner scheme is implemented for built-in macros.
// Skip if we are inside a named module (in contrast to an anonymous
// module defined by a block).
- if let ModuleKind::Def(_, _) = directive.parent_scope.module.kind {
+ if let ModuleKind::Def(..) = directive.parent_scope.module.kind {
return;
}