rust/tests/mir-opt/pre-codegen/slice_iter.range_loop.PreCodegen.after.panic-unwind.mir
2024-05-29 23:54:57 +00:00

107 lines
2.7 KiB
Rust

// MIR for `range_loop` after PreCodegen
fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
debug slice => _1;
debug f => _2;
let mut _0: ();
let mut _3: usize;
let mut _4: usize;
let mut _8: std::option::Option<usize>;
let mut _10: usize;
let mut _11: bool;
let mut _13: &impl Fn(usize, &T);
let mut _14: (usize, &T);
let _15: ();
scope 1 {
debug ((iter: std::ops::Range<usize>).0: usize) => _4;
debug ((iter: std::ops::Range<usize>).1: usize) => _3;
let _9: usize;
scope 2 {
debug i => _9;
let _12: &T;
scope 3 {
debug x => _12;
}
}
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
let mut _6: bool;
let _7: usize;
scope 7 {
}
scope 8 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
let mut _5: usize;
}
}
}
}
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
}
bb0: {
_3 = Len((*_1));
_4 = const 0_usize;
goto -> bb1;
}
bb1: {
StorageLive(_8);
StorageLive(_7);
StorageLive(_6);
StorageLive(_5);
_5 = _4;
_6 = Lt(move _5, _3);
StorageDead(_5);
switchInt(move _6) -> [0: bb2, otherwise: bb4];
}
bb2: {
StorageDead(_6);
StorageDead(_7);
StorageDead(_8);
drop(_2) -> [return: bb3, unwind continue];
}
bb3: {
return;
}
bb4: {
_7 = _4;
_4 = <usize as Step>::forward_unchecked(_7, const 1_usize) -> [return: bb5, unwind: bb8];
}
bb5: {
_8 = Option::<usize>::Some(_7);
StorageDead(_6);
StorageDead(_7);
_9 = ((_8 as Some).0: usize);
_10 = Len((*_1));
_11 = Lt(_9, _10);
assert(move _11, "index out of bounds: the length is {} but the index is {}", move _10, _9) -> [success: bb6, unwind: bb8];
}
bb6: {
_12 = &(*_1)[_9];
StorageLive(_13);
_13 = &_2;
StorageLive(_14);
_14 = (_9, _12);
_15 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _13, move _14) -> [return: bb7, unwind: bb8];
}
bb7: {
StorageDead(_14);
StorageDead(_13);
StorageDead(_8);
goto -> bb1;
}
bb8 (cleanup): {
drop(_2) -> [return: bb9, unwind terminate(cleanup)];
}
bb9 (cleanup): {
resume;
}
}