Poor parser error message when item category missing (assumes input is a macro) #40006
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-parser
Area: The parsing of Rust source code to an AST
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider this code (playpen):
It yields this error today:
In this case, the actual error is that the user left out the keyword after the visibility to indicate which kind of item they are trying to define here.
Our parser should be able to do a better job here. At the very least, if there is no trailing
!
, then instead of assuming that the input was a macro invocation, it should instead assume it was some item definition that is missing its keyword.The text was updated successfully, but these errors were encountered: