]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_expand/src/base.rs
Rollup merge of #100323 - GuillaumeGomez:impl-blocks-only-private, r=notriddle
[rust.git] / compiler / rustc_expand / src / base.rs
index 6e093811fcf6efe112c7bcb9ef25292a86ed091e..852ea806b20ff51c64139e3b5a2b293f7496b877 100644 (file)
@@ -772,7 +772,7 @@ pub fn new(
                 )
             })
             .unwrap_or_else(|| (None, helper_attrs));
-        let (stability, const_stability) = attr::find_stability(&sess, attrs, span);
+        let (stability, const_stability, body_stability) = attr::find_stability(&sess, attrs, span);
         if let Some((_, sp)) = const_stability {
             sess.parse_sess
                 .span_diagnostic
@@ -784,6 +784,17 @@ pub fn new(
                 )
                 .emit();
         }
+        if let Some((_, sp)) = body_stability {
+            sess.parse_sess
+                .span_diagnostic
+                .struct_span_err(sp, "macros cannot have body stability attributes")
+                .span_label(sp, "invalid body stability attribute")
+                .span_label(
+                    sess.source_map().guess_head_span(span),
+                    "body stability attribute affects this macro",
+                )
+                .emit();
+        }
 
         SyntaxExtension {
             kind,