This:
macro_rules! foo {
($bar) => {};
($baz $qux:ident) => {};
}
Produces:
error: missing fragment specifier
--> src/lib.rs:2:6
|
2 | ($bar) => {};
| ^^^^
...
error: missing fragment specifier
--> src/lib.rs:3:11
|
3 | ($baz $qux:ident) => {};
| ^
Notice for the second pattern, the diagnostic points at $qux rather than $baz. $qux is not a problem here, the span should look similar to $bar.
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=11ae576f5ce6e77fbad782f6c013ba76
Tested on both 1.80 and the 2024-08-13 nightly. This affects the new diagnostic that applies to e2024 added in #128006, as well as the existing lint (I noticed it looking at the reports in #128425).
This:
Produces:
Notice for the second pattern, the diagnostic points at
$quxrather than$baz.$quxis not a problem here, the span should look similar to$bar.https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=11ae576f5ce6e77fbad782f6c013ba76
Tested on both 1.80 and the 2024-08-13 nightly. This affects the new diagnostic that applies to e2024 added in #128006, as well as the existing lint (I noticed it looking at the reports in #128425).