Lint against --foo
when foo
is a numeric binding
#88669
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-parser
Area: The parsing of Rust source code to an AST
D-papercut
Diagnostics: An error or lint that needs small tweaks.
E-mentor
Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
As noted in #88553 (comment),
let x = --y;
is syntactically valid as a double negation, but it looks like C's pre-decrement. We should lint against it and suggest both removing the--
or writingy -= 1; let x = y;
.pre-increment, post-increment and post-decrement are not likely to confuse people too much because they are syntax errors, but we might also want to modify the parser to detect them specifically and provide a structured suggestion for appropriate code.
The text was updated successfully, but these errors were encountered: