rust/tests/ui/parser/macro/bad-macro-definition.stderr
Josh Triplett 0403990000 mbe: Gracefully handle macro rules that end after =>
Add a test for various cases of invalid macro definitions.

Closes: https://github.com/rust-lang/rust/issues/143351
2025-07-03 20:56:05 -07:00

57 lines
1.6 KiB
Plaintext

error: macro definition ended unexpectedly
--> $DIR/bad-macro-definition.rs:3:23
|
LL | macro_rules! a { {} => }
| ^ expected right-hand side of macro rule
error: invalid macro matcher; matchers must be contained in balanced delimiters
--> $DIR/bad-macro-definition.rs:6:18
|
LL | macro_rules! b { 0 => }
| ^
error: macro definition ended unexpectedly
--> $DIR/bad-macro-definition.rs:6:22
|
LL | macro_rules! b { 0 => }
| ^ expected right-hand side of macro rule
error: invalid macro matcher; matchers must be contained in balanced delimiters
--> $DIR/bad-macro-definition.rs:10:18
|
LL | macro_rules! c { x => }
| ^
error: macro definition ended unexpectedly
--> $DIR/bad-macro-definition.rs:10:22
|
LL | macro_rules! c { x => }
| ^ expected right-hand side of macro rule
error: invalid macro matcher; matchers must be contained in balanced delimiters
--> $DIR/bad-macro-definition.rs:14:18
|
LL | macro_rules! d { _ => }
| ^
error: macro definition ended unexpectedly
--> $DIR/bad-macro-definition.rs:14:22
|
LL | macro_rules! d { _ => }
| ^ expected right-hand side of macro rule
error: expected `=>`, found end of macro arguments
--> $DIR/bad-macro-definition.rs:18:20
|
LL | macro_rules! e { {} }
| ^ expected `=>`
error: macros must contain at least one rule
--> $DIR/bad-macro-definition.rs:21:1
|
LL | macro_rules! f {}
| ^^^^^^^^^^^^^^^^^
error: aborting due to 9 previous errors