2023-05-16 07:24:38 -05:00
|
|
|
// MIR for `range_loop` after PreCodegen
|
|
|
|
|
|
|
|
fn range_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug slice => _1;
|
|
|
|
debug f => _2;
|
|
|
|
let mut _0: ();
|
|
|
|
let mut _3: usize;
|
|
|
|
let mut _4: std::ops::Range<usize>;
|
|
|
|
let mut _5: std::ops::Range<usize>;
|
|
|
|
let mut _6: &mut std::ops::Range<usize>;
|
|
|
|
let mut _12: std::option::Option<usize>;
|
|
|
|
let mut _15: isize;
|
|
|
|
let mut _17: usize;
|
|
|
|
let mut _18: bool;
|
|
|
|
let mut _20: &impl Fn(usize, &T);
|
|
|
|
let mut _21: (usize, &T);
|
|
|
|
let _22: ();
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 1 {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug iter => _5;
|
|
|
|
let _16: usize;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 2 {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug i => _16;
|
|
|
|
let _19: &T;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 3 {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug x => _19;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
}
|
2023-06-06 08:47:00 -05:00
|
|
|
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<usize>>::next) {
|
|
|
|
debug self => _6;
|
|
|
|
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
|
|
|
|
debug self => _6;
|
|
|
|
let mut _7: &usize;
|
|
|
|
let mut _8: &usize;
|
|
|
|
let mut _11: bool;
|
|
|
|
let _13: usize;
|
|
|
|
let mut _14: usize;
|
2023-06-01 01:08:25 -05:00
|
|
|
scope 7 {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug old => _13;
|
2023-06-01 01:08:25 -05:00
|
|
|
scope 8 {
|
|
|
|
}
|
|
|
|
}
|
2023-06-06 08:47:00 -05:00
|
|
|
scope 9 (inlined cmp::impls::<impl PartialOrd for usize>::lt) {
|
|
|
|
debug self => _7;
|
|
|
|
debug other => _8;
|
|
|
|
let mut _9: usize;
|
|
|
|
let mut _10: usize;
|
2023-06-03 07:23:32 -05:00
|
|
|
}
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
}
|
2023-06-06 08:47:00 -05:00
|
|
|
scope 4 (inlined <std::ops::Range<usize> as IntoIterator>::into_iter) {
|
|
|
|
debug self => _4;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageLive(_3);
|
|
|
|
_3 = Len((*_1));
|
|
|
|
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 };
|
|
|
|
StorageDead(_3);
|
|
|
|
StorageLive(_5);
|
|
|
|
_5 = move _4;
|
|
|
|
goto -> bb1;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageLive(_12);
|
|
|
|
_6 = &mut _5;
|
|
|
|
StorageLive(_13);
|
|
|
|
StorageLive(_11);
|
|
|
|
StorageLive(_7);
|
|
|
|
_7 = &((*_6).0: usize);
|
|
|
|
StorageLive(_8);
|
|
|
|
_8 = &((*_6).1: usize);
|
|
|
|
StorageLive(_9);
|
|
|
|
_9 = (*_7);
|
|
|
|
StorageLive(_10);
|
|
|
|
_10 = (*_8);
|
|
|
|
_11 = Lt(move _9, move _10);
|
|
|
|
StorageDead(_10);
|
|
|
|
StorageDead(_9);
|
|
|
|
StorageDead(_8);
|
|
|
|
StorageDead(_7);
|
|
|
|
switchInt(move _11) -> [0: bb2, otherwise: bb3];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb2: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_12 = Option::<usize>::None;
|
|
|
|
goto -> bb5;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb3: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_13 = ((*_6).0: usize);
|
|
|
|
StorageLive(_14);
|
|
|
|
_14 = <usize as Step>::forward_unchecked(_13, const 1_usize) -> [return: bb4, unwind: bb12];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb4: {
|
2023-06-06 08:47:00 -05:00
|
|
|
((*_6).0: usize) = move _14;
|
|
|
|
StorageDead(_14);
|
|
|
|
_12 = Option::<usize>::Some(_13);
|
|
|
|
goto -> bb5;
|
2023-06-03 07:23:32 -05:00
|
|
|
}
|
|
|
|
|
2023-05-16 07:24:38 -05:00
|
|
|
bb5: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageDead(_11);
|
|
|
|
StorageDead(_13);
|
|
|
|
_15 = discriminant(_12);
|
|
|
|
switchInt(move _15) -> [0: bb6, 1: bb8, otherwise: bb11];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb6: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageDead(_12);
|
|
|
|
StorageDead(_5);
|
|
|
|
drop(_2) -> bb7;
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb7: {
|
2023-06-06 08:47:00 -05:00
|
|
|
return;
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb8: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_16 = ((_12 as Some).0: usize);
|
|
|
|
_17 = Len((*_1));
|
|
|
|
_18 = Lt(_16, _17);
|
|
|
|
assert(move _18, "index out of bounds: the length is {} but the index is {}", move _17, _16) -> [success: bb9, unwind: bb12];
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb9: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_19 = &(*_1)[_16];
|
|
|
|
StorageLive(_20);
|
|
|
|
_20 = &_2;
|
|
|
|
StorageLive(_21);
|
|
|
|
_21 = (_16, _19);
|
|
|
|
_22 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _20, move _21) -> [return: bb10, unwind: bb12];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb10: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageDead(_21);
|
|
|
|
StorageDead(_20);
|
|
|
|
StorageDead(_12);
|
|
|
|
goto -> bb1;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb11: {
|
2023-06-06 08:47:00 -05:00
|
|
|
unreachable;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb12 (cleanup): {
|
2023-06-06 08:47:00 -05:00
|
|
|
drop(_2) -> [return: bb13, unwind terminate];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb13 (cleanup): {
|
2023-06-06 08:47:00 -05:00
|
|
|
resume;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
}
|