In rustc_mir_transform, iterate over index newtypes instead of ints#139674
In rustc_mir_transform, iterate over index newtypes instead of ints#139674bors merged 1 commit intorust-lang:masterfrom
rustc_mir_transform, iterate over index newtypes instead of ints#139674Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
rustc_mir_tranform, iterator over index newtypes instead of intsrustc_mir_transform, iterator over index newtypes instead of ints
This comment was marked as resolved.
This comment was marked as resolved.
rustc_mir_transform, iterator over index newtypes instead of intsrustc_mir_transform, iterate over index newtypes instead of ints
|
|
||
| make_coroutine_state_argument_indirect(tcx, body); | ||
|
|
||
| match transform.coroutine_kind { |
There was a problem hiding this comment.
Change this back to a match and make it exhaustive, please.
!matches IMO makes it much easier to forget adding a variant in the future.
There was a problem hiding this comment.
Like this? It can be be even more exhaustive (i.e. on Movability and CoroutineSource)
There was a problem hiding this comment.
This is good enough
| @@ -1057,7 +1057,7 @@ fn insert_switch<'tcx>( | |||
| let blocks = body.basic_blocks_mut().iter_mut(); | |||
|
|
|||
| for target in blocks.flat_map(|b| b.terminator_mut().successors_mut()) { | |||
There was a problem hiding this comment.
can this be changed into a count?
There was a problem hiding this comment.
This loops over a bunch of BasicBlocks and increments each one, so something like *target += blocks.flat_map(..).count() would mean something completely different.
Unless I misunderstood you?
There was a problem hiding this comment.
Oh, I'm blind, lol. I thought we were incrementing a counter, not incrementing a per-bb index.
197dcb5 to
c36e8fc
Compare
|
@bors r+ rollup |
…terators, r=compiler-errors In `rustc_mir_transform`, iterate over index newtypes instead of ints Just makes code more idiomatic/easier to read, IMHO. Also, some drive-by simplifications and cleanups.
…terators, r=compiler-errors In `rustc_mir_transform`, iterate over index newtypes instead of ints Just makes code more idiomatic/easier to read, IMHO. Also, some drive-by simplifications and cleanups.
…enton Rollup of 12 pull requests Successful merges: - rust-lang#138744 (Add methods to TCP and UDP sockets to modify hop limit (refresh of rust-lang#94678)) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139666 (cleanup `mir_borrowck`) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139695 (compiletest: consistently use `camino::{Utf8Path,Utf8PathBuf}` throughout) - rust-lang#139722 (Move some things to rustc_type_ir) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) r? `@ghost` `@rustbot` modify labels: rollup
…terators, r=compiler-errors In `rustc_mir_transform`, iterate over index newtypes instead of ints Just makes code more idiomatic/easier to read, IMHO. Also, some drive-by simplifications and cleanups.
Rollup of 11 pull requests Successful merges: - rust-lang#137043 (Initial `UnsafePinned` implementation [Part 1: Libs]) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) - rust-lang#139741 (fix smir's run! doc and import) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#137043 (Initial `UnsafePinned` implementation [Part 1: Libs]) - rust-lang#138962 (Expect an array when expected and acutal types are both arrays during cast) - rust-lang#139001 (add `naked_functions_rustic_abi` feature gate) - rust-lang#139379 (Use delayed bug for normalization errors in drop elaboration) - rust-lang#139582 (Various coercion cleanups) - rust-lang#139628 (Suggest remove redundant `$()?` around `vis`) - rust-lang#139644 (Micro-optimize `InstSimplify`'s `simplify_primitive_clone`) - rust-lang#139674 (In `rustc_mir_transform`, iterate over index newtypes instead of ints) - rust-lang#139740 (Convert `tests/ui/lint/dead-code/self-assign.rs` to a known-bug test) - rust-lang#139741 (fix smir's run! doc and import) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139674 - yotamofek:pr/mir_transform/index-iterators, r=compiler-errors In `rustc_mir_transform`, iterate over index newtypes instead of ints Just makes code more idiomatic/easier to read, IMHO. Also, some drive-by simplifications and cleanups.
…li-obk Use `newtype_index!`-generated types more idiomatically Continuation of sorts of rust-lang#139674 Shouldn't affect anything, just makes some code simpler
…li-obk Use `newtype_index!`-generated types more idiomatically Continuation of sorts of rust-lang#139674 Shouldn't affect anything, just makes some code simpler
Rollup merge of rust-lang#139811 - yotamofek:pr/newtype_cleanups, r=oli-obk Use `newtype_index!`-generated types more idiomatically Continuation of sorts of rust-lang#139674 Shouldn't affect anything, just makes some code simpler
Just makes code more idiomatic/easier to read, IMHO.
Also, some drive-by simplifications and cleanups.