From a74f3fb5fc955fe3876fa206ce2146cd355e1bb5 Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Fri, 21 Feb 2025 16:01:07 -0500 Subject: [PATCH] Iterate directly on block indices in `rustc_mir_transform` --- compiler/rustc_mir_transform/src/check_pointers.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_mir_transform/src/check_pointers.rs b/compiler/rustc_mir_transform/src/check_pointers.rs index 72460542f87..fffd5974662 100644 --- a/compiler/rustc_mir_transform/src/check_pointers.rs +++ b/compiler/rustc_mir_transform/src/check_pointers.rs @@ -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];