-
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
Suggest i += 1
when we see i++
or ++i
#88672
Conversation
This comment has been minimized.
This comment has been minimized.
73917be
to
f72a701
Compare
Is there any way this could accidentally break macros that have |
This comment has been minimized.
This comment has been minimized.
(CI is just failing because I used |
Hi @camelid ; we visited this for triage. It looks like you had some questions you wanted answered, but also, @estebank had a suggestion for a change they wanted to see. What is the status on those fronts? Do you think you are stuck waiting for more feedback from @estebank, or can you make forward progress on the suggestion they provided in the meantime? |
It's been a while, but my recollection is that I implemented most of the user-facing side of what estebank suggested, but in a different way in the parser because I got stuck with the way estebank suggested. The way the change is implemented currently works pretty well, though sometimes the suggestions aren't as good as they could be. Perhaps it would be good to accept the current state of output as good enough for an "MVP PR" since it can be improved further in the future. That's of course assuming there aren't any major issues in the output. So, in summary: I think I need estebank to see if the impl looks okay and the error output looks good enough for a first implementation. |
@estebank could you take another look at this when you get a chance? |
☔ The latest upstream changes (presumably #91933) made this pull request unmergeable. Please resolve the merge conflicts. |
I'll wait to rebase until this is reviewed in case it needs more rebases. |
r? @davidtwco |
This solves the TODO.
This records that the suggestions are mutually-exclusive (i.e., only one should be applied).
`run-rustfix` applies all suggestions regardless of their Applicability. There's a flag, `rustfix-only-machine-applicable`, that does what it says, but then the produced `.fixed` file would have invalid code from the suggestions that weren't applied. So, I moved the cases of postfix increment, in which case multiple suggestions are given, to the `-notfixed` test, which does not run rustfix. I also changed the Applicability to Unspecified since MaybeIncorrect requires that the code be valid, even if it's incorrect.
I changed the test functions to be `pub` rather than called from a `main` function too, for easier future modification of tests.
af8c4fe
to
4943688
Compare
Ok, hopefully CI should pass now. |
This is great, thanks for seeing this through. Could you squash some of the commits? r=me after that. |
@davidtwco It's hard to squash without squashing all of them into one commit, and I'd rather keep the history to make it easier to understand the design choices for the code (e.g., when |
@bors r+ |
📌 Commit 4943688 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (133859d): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Thank you so much for helping me with this PR and being patient even though it took me forever to finish it! ❤️ |
Closes #83502 (for
i++
and++i
;--i
should be covered by #82987, andi--
is tricky to handle).
This is a continuation of #83536.
r? @estebank