]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_resolve/src/build_reduced_graph.rs
New upstream version 1.53.0+dfsg1
[rustc.git] / compiler / rustc_resolve / src / build_reduced_graph.rs
index d77022a65e43979d32baa55fd0fa6b3d9b5de9f7..b5c95cfcb29cbe46e57f414ecef95e53bed03674 100644 (file)
@@ -1230,13 +1230,13 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
         };
 
         let res = Res::Def(DefKind::Macro(ext.macro_kind()), def_id.to_def_id());
-        let is_macro_export = self.r.session.contains_name(&item.attrs, sym::macro_export);
         self.r.macro_map.insert(def_id.to_def_id(), ext);
         self.r.local_macro_def_scopes.insert(def_id, parent_scope.module);
 
-        if macro_rules && matches!(item.vis.kind, ast::VisibilityKind::Inherited) {
+        if macro_rules {
             let ident = ident.normalize_to_macros_2_0();
             self.r.macro_names.insert(ident);
+            let is_macro_export = self.r.session.contains_name(&item.attrs, sym::macro_export);
             let vis = if is_macro_export {
                 ty::Visibility::Public
             } else {
@@ -1261,11 +1261,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
                 }),
             ))
         } else {
-            if is_macro_export {
-                let what = if macro_rules { "`macro_rules` with `pub`" } else { "`macro` items" };
-                let msg = format!("`#[macro_export]` cannot be used on {what}");
-                self.r.session.span_err(item.span, &msg);
-            }
             let module = parent_scope.module;
             let vis = match item.kind {
                 // Visibilities must not be resolved non-speculatively twice