about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-07-28 04:12:12 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-08-08 11:01:12 -0700
commitf0a5e70507c095c4f912f2b0ec31a18bd1447694 (patch)
tree81039e1b01fde67dc44247c303e0ae2d75c4b3ad
parentbad0d45b2dc2b2be36e9e82604a6c3dd95dba08a (diff)
downloadrust-f0a5e70507c095c4f912f2b0ec31a18bd1447694.tar.gz
rust-f0a5e70507c095c4f912f2b0ec31a18bd1447694.zip
mbe: Fix error message for using a macro with no `attr` rules as an attribute
Avoid saying "a declarative macro cannot be used as an attribute macro";
instead, say that the macro has no `attr` rules.
-rw-r--r--compiler/rustc_resolve/messages.ftl2
-rw-r--r--tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl
index 39e9a9cc58a..ceef558c0cf 100644
--- a/compiler/rustc_resolve/messages.ftl
+++ b/compiler/rustc_resolve/messages.ftl
@@ -243,7 +243,7 @@ resolve_lowercase_self =
     .suggestion = try using `Self`
 
 resolve_macro_cannot_use_as_attr =
-    `{$ident}` exists, but a declarative macro cannot be used as an attribute macro
+    `{$ident}` exists, but has no `attr` rules
 
 resolve_macro_cannot_use_as_derive =
      `{$ident}` exists, but a declarative macro cannot be used as a derive macro
diff --git a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr
index e5b913b208d..77f8bef83a4 100644
--- a/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr
+++ b/tests/ui/macros/macro-rules-as-derive-or-attr-issue-132928.stderr
@@ -11,7 +11,7 @@ error: cannot find attribute `sample` in this scope
   --> $DIR/macro-rules-as-derive-or-attr-issue-132928.rs:5:3
    |
 LL | macro_rules! sample { () => {} }
-   |              ------ `sample` exists, but a declarative macro cannot be used as an attribute macro
+   |              ------ `sample` exists, but has no `attr` rules
 LL |
 LL | #[sample]
    |   ^^^^^^