Add diagnostic for ++ and -- usages #83502
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
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.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code in the playground:
The current output is:
I think the message for errors involving
++
or--
should understand that the user is trying to use an operator which doesn't exist in Rust and suggest an idiomatic way to do the increment/decrement operation.Explanation
Languages like C, Java or Javascript use
++
and--
to increment or decrement integer variables, respectively. As Rust does not support them, it may be good to add an specific diagnostic for those cases, suggesting the user to use something likei += 1
instead.The text was updated successfully, but these errors were encountered: