Confusing error message when mis-spelling macro invocation #38126
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-parser
Area: The parsing of Rust source code to an AST
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When compiling
the following error is generated
This happens because the only thing that could possibly be in an item position and not start with a keyword is a macro, and macros start with a path. A path can contain double colons. However, a macro invocation can not, and the compiler will generate an error at a later stage if you try to invoke a macro that way. See #28558
To be clear, I think the error message should just be “expected `!`, found `{`”.
The text was updated successfully, but these errors were encountered: