// if it cannot be shadowed by some new item/import expanded from a macro.
// This happens either if there are no unexpanded macros, or expanded names cannot
// shadow globs (that happens in macro namespace or with restricted shadowing).
- let unexpanded_macros = !module.unresolved_invocations.borrow().is_empty();
+ let unexpanded_macros = !module.unresolved_invocations.borrow().is_empty() ||
+ (ns == MacroNS && ptr::eq(module, self.graph_root) &&
+ !self.unresolved_invocations_macro_export.is_empty());
if let Some(binding) = resolution.binding {
if !unexpanded_macros || ns == MacroNS || restricted_shadowing {
return check_usable(self, binding);
resolution.binding = Some(binding);
resolution.shadowed_glob = Some(old_binding);
}
+ } else if let (&NameBindingKind::Def(_, true), &NameBindingKind::Def(_, true)) =
+ (&old_binding.kind, &binding.kind) {
+
+ this.session.buffer_lint_with_diagnostic(
+ DUPLICATE_MACRO_EXPORTS,
+ CRATE_NODE_ID,
+ binding.span,
+ &format!("a macro named `{}` has already been exported", ident),
+ BuiltinLintDiagnostics::DuplicatedMacroExports(
+ ident, old_binding.span, binding.span));
+
+ resolution.binding = Some(binding);
} else {
return Err(old_binding);
}
match binding.kind {
// Never suggest the name that has binding error
// i.e. the name that cannot be previously resolved
- NameBindingKind::Def(Def::Err) => return None,
+ NameBindingKind::Def(Def::Err, _) => return None,
_ => Some(&i.name),
}
},