about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-08-08 10:38:46 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-08-08 11:01:12 -0700
commit150019579979ecd6121204f735e525063c184b5d (patch)
tree1fe5653990f157f7c48c0f2c569c3b03de1180ab
parentbd5206ee1846f90579e644ebc7874a7300fc6171 (diff)
downloadrust-150019579979ecd6121204f735e525063c184b5d.tar.gz
rust-150019579979ecd6121204f735e525063c184b5d.zip
mbe: Add a test for calling a macro with no function-like rules
-rw-r--r--tests/ui/macros/macro-rules-attr-error.rs2
-rw-r--r--tests/ui/macros/macro-rules-attr-error.stderr11
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/ui/macros/macro-rules-attr-error.rs b/tests/ui/macros/macro-rules-attr-error.rs
index 59fb32a5bfc..1c8bb251e20 100644
--- a/tests/ui/macros/macro-rules-attr-error.rs
+++ b/tests/ui/macros/macro-rules-attr-error.rs
@@ -10,4 +10,6 @@ macro_rules! local_attr {
 fn main() {
     #[local_attr]
     struct S;
+
+    local_attr!(arg); //~ ERROR: macro has no rules for function-like invocation
 }
diff --git a/tests/ui/macros/macro-rules-attr-error.stderr b/tests/ui/macros/macro-rules-attr-error.stderr
index 7d033ae3f03..177b7009384 100644
--- a/tests/ui/macros/macro-rules-attr-error.stderr
+++ b/tests/ui/macros/macro-rules-attr-error.stderr
@@ -9,5 +9,14 @@ LL |     #[local_attr]
    |
    = note: this error originates in the attribute macro `local_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: aborting due to 1 previous error
+error: macro has no rules for function-like invocation `local_attr!`
+  --> $DIR/macro-rules-attr-error.rs:14:5
+   |
+LL | macro_rules! local_attr {
+   | ----------------------- this macro has no rules for function-like invocation
+...
+LL |     local_attr!(arg);
+   |     ^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors