Use IndexVec::indices
instead of reimplementing it
The change is limited to the iteration over indices instead of using `basic_blocks_mut()` directly, in the case the previous implementation intentionally avoided invalidating the caches stored in MIR body.
This commit is contained in:
parent
763703cb76
commit
d5a91f3114
1 changed files with 2 additions and 6 deletions
|
@ -3,8 +3,7 @@
|
|||
use crate::MirPass;
|
||||
use rustc_data_structures::stable_set::FxHashSet;
|
||||
use rustc_middle::mir::{
|
||||
BasicBlock, BasicBlockData, Body, Local, Operand, Rvalue, StatementKind, SwitchTargets,
|
||||
TerminatorKind,
|
||||
BasicBlockData, Body, Local, Operand, Rvalue, StatementKind, SwitchTargets, TerminatorKind,
|
||||
};
|
||||
use rustc_middle::ty::layout::TyAndLayout;
|
||||
use rustc_middle::ty::{Ty, TyCtxt};
|
||||
|
@ -73,10 +72,7 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching {
|
|||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
trace!("UninhabitedEnumBranching starting for {:?}", body.source);
|
||||
|
||||
let basic_block_count = body.basic_blocks().len();
|
||||
|
||||
for bb in 0..basic_block_count {
|
||||
let bb = BasicBlock::from_usize(bb);
|
||||
for bb in body.basic_blocks().indices() {
|
||||
trace!("processing block {:?}", bb);
|
||||
|
||||
let Some(discriminant_ty) = get_switched_on_type(&body.basic_blocks()[bb], tcx, body) else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue