-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #108495, postfix decrement and prefix decrement has no warning #108496
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @WaffleLapkin (or someone else) soon. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR, but we cannot do this recovery this way.
let _ = i--i;
and
let _ = --i;
compile today (double negation). The only case we would be able to handle is the case of something like i--+i
, which is not allowed today. You'd have to be careful to make sure that whatever comes after the second -
is not allowed to start an expression (there should be a helper function for that). I think it should work then, but I'm not entirely sure.
I see your issues mentions a "warning". I think emitting a warning on double negation is a great idea!
Fyi, Clippy already emits a warning for this by default:
Not sure if it's worth moving this Clippy lint into rustc (this sometimes does happen though, although I don't know what the process is usually like). |
The process is more or less "ask T-compiler for approval, if they give a green light, make a PR that adds (to rustc) and deprecates (in clippy) the lint". See #99272 and #99696 as an example. Although I don't think it's worth it in the case of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
(I've committed some small fmt changes so that I don't bother you with them)
@bors r+ rollup |
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#108376 (compiler/rustc_session: fix sysroot detection logic) - rust-lang#108400 (add llvm cgu instructions stats to perf) - rust-lang#108496 (fix rust-lang#108495, postfix decrement and prefix decrement has no warning) - rust-lang#108505 (Further unify validity intrinsics) - rust-lang#108520 (Small cleanup to `one_bound_for_assoc_type`) - rust-lang#108560 (Some `infer/mod.rs` cleanups) - rust-lang#108563 (Make mailmap more correct) - rust-lang#108564 (Fix `x clean` with specific paths) - rust-lang#108571 (Add contains_key to SortedIndexMultiMap) - rust-lang#108578 (Update Fuchsia platform team members) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #108495