-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Perform unused assignment and unused variables lints on MIR. #101500
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @celinval, @vakaras |
r? @davidtwco (rust-highfive has picked a reviewer for you, use r? to override) |
82c11f4
to
897b0db
Compare
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
8844e49
to
521f4e2
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
☔ The latest upstream changes (presumably #109092) made this pull request unmergeable. Please resolve the merge conflicts. |
20ad900
to
8322e70
Compare
☔ The latest upstream changes (presumably #96840) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #106934) made this pull request unmergeable. Please resolve the merge conflicts. |
Some changes might have occurred in exhaustiveness checking cc @Nadrieril |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #113646) made this pull request unmergeable. Please resolve the merge conflicts. |
@cjgillot any updates on this |
This comment was marked as outdated.
This comment was marked as outdated.
oh nvm this was blocked |
Some changes occurred in match lowering cc @Nadrieril |
@@ -738,6 +738,7 @@ pub enum PatKind<'tcx> { | |||
/// Is this the leftmost occurrence of the binding, i.e., is `var` the | |||
/// `HirId` of this pattern? | |||
is_primary: bool, | |||
is_shorthand: bool, |
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.
Could you document what "shorthand" means?
The job Click to see the possible cause of the failure (guessed by this bot)
|
☔ The latest upstream changes (presumably #123569) made this pull request unmergeable. Please resolve the merge conflicts. |
Based on #101399Based on #102256Blocked on #108993
Rough attempt to #51003.
This is my first stab at using the dataflow framework, so please be gentle 😄
In order to keep the same level of diagnostics, I had to instrument MIR a little more:
let _ =
syntax. This changes the behaviour oflet _ = <access to unsafe field>
currently type-checks #54003, I don't know if it's still desirable.VarBindingForm
the list of introducer places and whether this was a shorthand pattern.I am not very proud of the handling of self-assignments. The proposed scheme is in two parts: first detect probable self-assignments, by pattern matching on MIR, and second treat them specially during dataflow analysis. I welcome ideas.
I did not attempt to rewrite the dead-code lint, as #100288 does it.