From 55ca03c0ac840d6f4f30f61bc381b02ca095b899 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 8 Apr 2022 22:51:13 +0200 Subject: [PATCH] Insert error after checking for binding usability. --- compiler/rustc_resolve/src/ident.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index e528a50d147..776ad704732 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -913,12 +913,6 @@ impl<'a> Resolver<'a> { return Err((Determined, Weak::No)); }; - if !restricted_shadowing && binding.expansion != LocalExpnId::ROOT { - if let NameBindingKind::Res(_, true) = binding.kind { - self.macro_expanded_macro_export_errors.insert((path_span, binding.span)); - } - } - // If the primary binding is unusable, search further and return the shadowed glob // binding if it exists. What we really want here is having two separate scopes in // a module - one for non-globs and one for globs, but until that's done use this @@ -965,6 +959,12 @@ impl<'a> Resolver<'a> { }); } + if !restricted_shadowing && binding.expansion != LocalExpnId::ROOT { + if let NameBindingKind::Res(_, true) = binding.kind { + self.macro_expanded_macro_export_errors.insert((path_span, binding.span)); + } + } + self.record_use(ident, binding, restricted_shadowing); return Ok(binding); }