about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2024-07-26 02:20:30 -0400
committerGitHub <noreply@github.com>2024-07-26 02:20:30 -0400
commitc5788d618e6bda1e3be098e909bd35f48e2e1cd1 (patch)
tree3dcbbb04a7db892c6bb2729b7aa9806f0ca7c283 /tests
parent96fb3544b098ac311259c9591eb60f25a6cb8422 (diff)
parent2fca4ea317f2f45a9a6f8272e52661807b100ca3 (diff)
downloadrust-c5788d618e6bda1e3be098e909bd35f48e2e1cd1.tar.gz
rust-c5788d618e6bda1e3be098e909bd35f48e2e1cd1.zip
Rollup merge of #127557 - linyihai:issue-126694, r=compiler-errors
Add a label to point to the lacking macro name definition

Fixes https://github.com/rust-lang/rust/issues/126694, but adopts the suggestion from https://github.com/rust-lang/rust/issues/118295

```
 --> src/main.rs:1:14
  |
1 | macro_rules! {
  |            ^ put a macro name here
```
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/macros/issue-118786.rs1
-rw-r--r--tests/ui/macros/issue-118786.stderr6
-rw-r--r--tests/ui/resolve/issue-118295.rs6
-rw-r--r--tests/ui/resolve/issue-118295.stderr18
4 files changed, 25 insertions, 6 deletions
diff --git a/tests/ui/macros/issue-118786.rs b/tests/ui/macros/issue-118786.rs
index 97454c9de07..a41372e4ea8 100644
--- a/tests/ui/macros/issue-118786.rs
+++ b/tests/ui/macros/issue-118786.rs
@@ -7,6 +7,7 @@ macro_rules! make_macro {
         macro_rules! $macro_name {
         //~^ ERROR macro expansion ignores token `{` and any following
         //~| ERROR cannot find macro `macro_rules` in this scope
+        //~| put a macro name here
             () => {}
         }
     }
diff --git a/tests/ui/macros/issue-118786.stderr b/tests/ui/macros/issue-118786.stderr
index 03e65c94ba7..256b742ee16 100644
--- a/tests/ui/macros/issue-118786.stderr
+++ b/tests/ui/macros/issue-118786.stderr
@@ -1,5 +1,5 @@
 error: macros that expand to items must be delimited with braces or followed by a semicolon
-  --> $DIR/issue-118786.rs:15:13
+  --> $DIR/issue-118786.rs:16:13
    |
 LL | make_macro!((meow));
    |             ^^^^^^
@@ -34,10 +34,10 @@ LL | make_macro!((meow));
    | ------------------- in this macro invocation
    |
 note: maybe you have forgotten to define a name for this `macro_rules!`
-  --> $DIR/issue-118786.rs:7:9
+  --> $DIR/issue-118786.rs:7:20
    |
 LL |         macro_rules! $macro_name {
-   |         ^^^^^^^^^^^
+   |                    ^ put a macro name here
 ...
 LL | make_macro!((meow));
    | ------------------- in this macro invocation
diff --git a/tests/ui/resolve/issue-118295.rs b/tests/ui/resolve/issue-118295.rs
index b97681d9563..37a49baee80 100644
--- a/tests/ui/resolve/issue-118295.rs
+++ b/tests/ui/resolve/issue-118295.rs
@@ -1,5 +1,11 @@
 macro_rules! {}
 //~^ ERROR cannot find macro `macro_rules` in this scope
 //~| NOTE maybe you have forgotten to define a name for this `macro_rules!`
+//~| put a macro name here
+
+macro_rules!{}
+//~^ ERROR cannot find macro `macro_rules` in this scope
+//~| NOTE maybe you have forgotten to define a name for this `macro_rules!`
+//~| put a macro name here
 
 fn main() {}
diff --git a/tests/ui/resolve/issue-118295.stderr b/tests/ui/resolve/issue-118295.stderr
index d60d7d9185d..06a37e81d6c 100644
--- a/tests/ui/resolve/issue-118295.stderr
+++ b/tests/ui/resolve/issue-118295.stderr
@@ -1,14 +1,26 @@
 error: cannot find macro `macro_rules` in this scope
-  --> $DIR/issue-118295.rs:1:1
+  --> $DIR/issue-118295.rs:6:1
    |
-LL | macro_rules! {}
+LL | macro_rules!{}
    | ^^^^^^^^^^^
    |
 note: maybe you have forgotten to define a name for this `macro_rules!`
+  --> $DIR/issue-118295.rs:6:12
+   |
+LL | macro_rules!{}
+   |            ^ put a macro name here
+
+error: cannot find macro `macro_rules` in this scope
   --> $DIR/issue-118295.rs:1:1
    |
 LL | macro_rules! {}
    | ^^^^^^^^^^^
+   |
+note: maybe you have forgotten to define a name for this `macro_rules!`
+  --> $DIR/issue-118295.rs:1:12
+   |
+LL | macro_rules! {}
+   |            ^ put a macro name here
 
-error: aborting due to 1 previous error
+error: aborting due to 2 previous errors