mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Iterate directly on block indices in rustc_mir_transform
This commit is contained in:
parent
6041d18de5
commit
a74f3fb5fc
@ -70,8 +70,7 @@ pub(crate) fn check_pointers<'a, 'tcx, F>(
|
||||
// statements/blocks after. Iterating or visiting the MIR in order would require updating
|
||||
// our current location after every insertion. By iterating backwards, we dodge this issue:
|
||||
// The only Locations that an insertion changes have already been handled.
|
||||
for block in (0..basic_blocks.len()).rev() {
|
||||
let block = block.into();
|
||||
for block in basic_blocks.indices().rev() {
|
||||
for statement_index in (0..basic_blocks[block].statements.len()).rev() {
|
||||
let location = Location { block, statement_index };
|
||||
let statement = &basic_blocks[block].statements[statement_index];
|
||||
|
Loading…
Reference in New Issue
Block a user