-
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
More rustc_mir_dataflow
cleanups
#118638
More rustc_mir_dataflow
cleanups
#118638
Conversation
The third commit might be controversial, but the |
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.
I disagree with the 3rd commit. All the logic around gen-kill analyses relies on the exact implementation of the blanket impl you remove. With a macro, we do not enforce the implementation any more (client code could avoid using it), that could lead to inconsistencies and bugs.
It is used just once. With it removed, the relevant code is a little boilerplate-y but much easier to read, and is the same length. Overall I think it's an improvement.
This results in two non-generic types being used: `BorrowckResults` and `BorrowckFlowState`. It's a net reduction in lines of code, and a little easier to read.
`GenKillAnalysis` has five methods that take a transfer function arg: - `statement_effect` - `before_statement_effect` - `terminator_effect` - `before_terminator_effect` - `call_return_effect` All the transfer function args have type `&mut impl GenKill<Self::Idx>`, except for `terminator_effect`, which takes the simpler `Self::Domain`. But only the first two need to be `impl GenKill`. The other three can all be `Self::Domain`, just like `Analysis`. So this commit changes the last two to take `Self::Domain`, making `GenKillAnalysis` and `Analysis` more similar. (Another idea would be to make all these methods `impl GenKill`. But that doesn't work: `MaybeInitializedPlaces::terminator_effect` requires the arg be `Self::Domain` so that `self_is_unwind_dead(place, state)` can be called on it.)
db7352d
to
4b364b6
Compare
Ok, fair enough. I have replaced it with a smaller commit that changes the type of the |
So there are now four commits. The first two are unchanged, the last two are new and need reviewing. |
Thanks! |
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#117953 (Add more SIMD platform-intrinsics) - rust-lang#118057 (dedup for duplicate suggestions) - rust-lang#118638 (More `rustc_mir_dataflow` cleanups) - rust-lang#118702 (Strengthen well known check-cfg names and values test) - rust-lang#118734 (Unescaping cleanups) - rust-lang#118766 (Lower some forgotten spans) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#118638 - nnethercote:rustc_mir_dataflow-more, r=cjgillot More `rustc_mir_dataflow` cleanups r? `@cjgillot`
…aflow-cleanups, r=<try> Still more `rustc_mir_dataflow` cleanups A sequel to rust-lang#118203, rust-lang#118230, rust-lang#118638, and rust-lang#131481. I'm pleased with this PR. It cleans up a few things that have been bugging me for a while. It took quite some effort to find these improvements. r? `@cjgillot`
r? @cjgillot