-
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
rustc_mir_transform
cleanups 3
#130175
rustc_mir_transform
cleanups 3
#130175
Conversation
By reflowing comment lines that are too long, and a few that are very short. Plus some other very minor formatting tweaks.
These are all functions with a single callsite, where having a separate function does nothing to help with readability. These changes make the code a little shorter and easier to read.
The "as" is equivalent to "because", but I originally read it more like "when", which was confusing.
This was non-obvious to me.
In all cases the struct can own the relevant thing instead of having a reference to it. This makes the code simpler, and in some cases removes a struct lifetime.
It's a thin wrapper around `check_live_drops`, but it's enough to fix the FIXME comment.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred in coverage instrumentation. cc @Zalathar |
// need to also add a retag statement. *Except* if we are deref'ing a | ||
// Box, because those get desugared to directly working with the inner | ||
// raw pointer! That's relevant for `RawPtr` as Miri otherwise makes it |
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.
My kingdom for a code review tool that can ignore this diff
// Clone dominators because we need them while mutating the body. | ||
let dominators = body.basic_blocks.dominators().clone(); | ||
|
||
let mut state = VnState::new(tcx, body, param_env, &ssa, dominators, &body.local_decls); |
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.
What happened here? How did rustfmt let the original code be?
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 don't see what's wrong with the original code...
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.
Upon further inspection, I don't either. The way "remove whitespace" displayed this part of the diff confused me.
None, | ||
); | ||
check_consts::post_drop_elaboration::check_live_drops(tcx, body); // FIXME: make this a MIR lint |
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.
pm::run_passes
has a bit of extra logic in it for running MIR linting/validation as well as -Zmir-enable-passes
. So this isn't necessarily a no-op, but I'm down with following the FIXME.
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 think this is just a comment, not a request for a change, right?
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.
Yeah. Just a comment.
I have a question (and two comments, such as they are) ^ |
// A move out of a projection of a copy is equivalent to a copy of the original | ||
// projection. |
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.
Nitpick: These single-word reflows are a bit awkward.
For single-line comments that don't quite fit in 100 columns, I'd consider breaking them even earlier (closer to 80 columns) just so that the second line is a bit longer.
(But if you're using automation to do this then maybe it's not worth the extra effort. 🤷♂️)
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 just reflowed them all to width 100, because that's the closest I could get to the original while observing the "don't exceed 100 chars" rule. I definitely don't want to be thinking about different widths for different comments depending on their contents. One word on a line by itself is fine.
@bors r+ |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#130143 (miri-test-libstd: add missing BOOTSTRAP_ARGS) - rust-lang#130173 (rustdoc: add two regression tests) - rust-lang#130175 (`rustc_mir_transform` cleanups 3) - rust-lang#130184 (coverage: Clean up terminology in counter creation) - rust-lang#130185 (abi/compatibility test: remove tests inside repr(C) wrappers) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#130143 (miri-test-libstd: add missing BOOTSTRAP_ARGS) - rust-lang#130173 (rustdoc: add two regression tests) - rust-lang#130175 (`rustc_mir_transform` cleanups 3) - rust-lang#130184 (coverage: Clean up terminology in counter creation) - rust-lang#130185 (abi/compatibility test: remove tests inside repr(C) wrappers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130175 - nnethercote:rustc_mir_transform-cleanups-3, r=saethlin `rustc_mir_transform` cleanups 3 More cleanups in the style of rust-lang#129929. r? `@saethlin`
More cleanups in the style of #129929.
r? @saethlin