Closed
Description
For the code:
macro_rules! foo {
($something:expr invalid) => {{
// ...
}};
}
macro_rules! bar {
($something:stmt invalid) => {{
// ...
}};
}
fn main() {
foo!(true invalid);
bar!(true invalid);
}
The compiler would give the following errors for this
error: `$something:expr` is followed by `invalid`, which is not allowed for `expr` fragments
--> <anon>:2:22
2 |> ($something:expr invalid) => {{
|> ^^^^^^^
error: `$something:stmt` is followed by `invalid`, which is not allowed for `stmt` fragments
--> <anon>:8:22
8 |> ($something:stmt invalid) => {{
|>
I think it would be better if the error clarified that expr
/stmt
in macros can may only be followed by one of: => , ;