Error message is misleading for missing semicolon between raw string literal and attribute #95030
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8b5f6ac92ab1ea3dbc9d74c8d63d7514
The current output is:
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=28a29f9c008732dd3e7fc75455a4e325
The current output is:
The problem with the error message is that there is nothing wrong with the raw string literals (as rustc notes, they don't use any
#
s anyway); in particular, the raw string literals are not incorrectly terminated. Rather, it is the item declaration or statement that is terminated incorrectly, in that it is missing its terminating semicolon. Besides being misleading as to the problem with the code, the error message includes a suggestion that would only break the syntax further.I suggest this is a minor issue, especially as no-one appears to have reported it yet.
This issue appears to apply to stable, beta, and nightly.
The text was updated successfully, but these errors were encountered: