rust
rust copied to clipboard
Confusing source location for "missing fragment specifier"
Here's some code incorrectly defining a macro, because it's missing a fragment specifier. Playground
macro_rules! m {
($x [$y: ident]) => {}
}
Here's the error message rustc gives me:
error: missing fragment specifier
[--> src/lib.rs:2:9
](https://play.rust-lang.org/#) |
2 | ($x [$y: ident]) => {}
| ^^^^^^^^^^^
|
It's potentially confusing that the error points to the source after the name with the missing fragment specifier. Especially in a complicated macro, it would be better if it pointed to the item which was actually missing the fragment specifier.
@rustbot claim
Some more context at https://github.com/rust-lang/rust/issues/129077