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;
|
2023-08-17 12:06:55 -05:00
|
|
|
let mut _4: std::ops::Range<usize>;
|
|
|
|
let mut _5: std::ops::Range<usize>;
|
2023-01-12 14:04:42 -06:00
|
|
|
let mut _6: &mut std::ops::Range<usize>;
|
2023-01-18 11:57:50 -06:00
|
|
|
let mut _14: std::option::Option<usize>;
|
|
|
|
let mut _16: usize;
|
|
|
|
let mut _17: bool;
|
|
|
|
let mut _19: &impl Fn(usize, &T);
|
|
|
|
let mut _20: (usize, &T);
|
|
|
|
let _21: ();
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 1 {
|
2023-08-17 12:06:55 -05:00
|
|
|
debug iter => _5;
|
2023-01-18 11:57:50 -06:00
|
|
|
let _15: usize;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 2 {
|
2023-01-18 11:57:50 -06:00
|
|
|
debug i => _15;
|
|
|
|
let _18: &T;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 3 {
|
2023-01-18 11:57:50 -06:00
|
|
|
debug x => _18;
|
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) {
|
2023-01-12 14:04:42 -06:00
|
|
|
debug self => _6;
|
2023-06-06 08:47:00 -05:00
|
|
|
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
|
2023-01-12 14:04:42 -06:00
|
|
|
debug self => _6;
|
|
|
|
let mut _7: &usize;
|
|
|
|
let mut _8: &usize;
|
|
|
|
let mut _11: bool;
|
2023-01-18 11:57:50 -06:00
|
|
|
let _12: usize;
|
|
|
|
let mut _13: usize;
|
2023-06-01 01:08:25 -05:00
|
|
|
scope 7 {
|
2023-01-18 11:57:50 -06:00
|
|
|
debug old => _12;
|
2023-06-01 01:08:25 -05:00
|
|
|
scope 8 {
|
|
|
|
}
|
|
|
|
}
|
2023-11-19 18:04:06 -06:00
|
|
|
scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::lt) {
|
2023-01-12 14:04:42 -06:00
|
|
|
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) {
|
2023-08-17 12:06:55 -05:00
|
|
|
debug self => _4;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
2023-08-17 12:06:55 -05:00
|
|
|
StorageLive(_3);
|
2023-06-06 08:47:00 -05:00
|
|
|
_3 = Len((*_1));
|
2023-08-17 12:06:55 -05:00
|
|
|
_4 = std::ops::Range::<usize> { start: const 0_usize, end: move _3 };
|
|
|
|
StorageDead(_3);
|
|
|
|
StorageLive(_5);
|
2024-01-06 12:34:25 -06:00
|
|
|
_5 = _4;
|
2023-06-06 08:47:00 -05:00
|
|
|
goto -> bb1;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-01-18 11:57:50 -06:00
|
|
|
StorageLive(_14);
|
2023-01-12 14:04:42 -06:00
|
|
|
_6 = &mut _5;
|
2023-01-18 11:57:50 -06:00
|
|
|
StorageLive(_12);
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageLive(_11);
|
|
|
|
StorageLive(_7);
|
|
|
|
_7 = &(_5.0: usize);
|
|
|
|
StorageLive(_8);
|
|
|
|
_8 = &(_5.1: usize);
|
2023-08-17 12:06:55 -05:00
|
|
|
StorageLive(_9);
|
2023-01-12 14:04:42 -06:00
|
|
|
_9 = (_5.0: usize);
|
2023-08-17 12:06:55 -05:00
|
|
|
StorageLive(_10);
|
2023-01-12 14:04:42 -06:00
|
|
|
_10 = (_5.1: usize);
|
|
|
|
_11 = Lt(move _9, move _10);
|
|
|
|
StorageDead(_10);
|
|
|
|
StorageDead(_9);
|
2023-01-18 11:57:50 -06:00
|
|
|
switchInt(move _11) -> [0: bb2, otherwise: bb4];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb2: {
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageDead(_8);
|
|
|
|
StorageDead(_7);
|
2023-01-18 11:57:50 -06:00
|
|
|
StorageDead(_11);
|
|
|
|
StorageDead(_12);
|
|
|
|
StorageDead(_14);
|
|
|
|
StorageDead(_5);
|
|
|
|
drop(_2) -> [return: bb3, unwind unreachable];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb3: {
|
2023-01-18 11:57:50 -06:00
|
|
|
return;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb4: {
|
2023-01-18 11:57:50 -06:00
|
|
|
StorageDead(_8);
|
|
|
|
StorageDead(_7);
|
|
|
|
_12 = (_5.0: usize);
|
|
|
|
StorageLive(_13);
|
|
|
|
_13 = <usize as Step>::forward_unchecked(_12, const 1_usize) -> [return: bb5, unwind unreachable];
|
2023-06-03 07:23:32 -05:00
|
|
|
}
|
|
|
|
|
2023-05-16 07:24:38 -05:00
|
|
|
bb5: {
|
2023-01-18 11:57:50 -06:00
|
|
|
(_5.0: usize) = move _13;
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageDead(_13);
|
2023-01-18 11:57:50 -06:00
|
|
|
_14 = Option::<usize>::Some(_12);
|
|
|
|
StorageDead(_11);
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageDead(_12);
|
2023-01-18 11:57:50 -06:00
|
|
|
_15 = ((_14 as Some).0: usize);
|
|
|
|
_16 = Len((*_1));
|
|
|
|
_17 = Lt(_15, _16);
|
|
|
|
assert(move _17, "index out of bounds: the length is {} but the index is {}", move _16, _15) -> [success: bb6, unwind unreachable];
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
|
|
|
|
2023-01-18 11:57:50 -06:00
|
|
|
bb6: {
|
|
|
|
_18 = &(*_1)[_15];
|
|
|
|
StorageLive(_19);
|
|
|
|
_19 = &_2;
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageLive(_20);
|
2023-01-18 11:57:50 -06:00
|
|
|
_20 = (_15, _18);
|
|
|
|
_21 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _19, move _20) -> [return: bb7, unwind unreachable];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-01-18 11:57:50 -06:00
|
|
|
bb7: {
|
2023-01-12 14:04:42 -06:00
|
|
|
StorageDead(_20);
|
2023-01-18 11:57:50 -06:00
|
|
|
StorageDead(_19);
|
|
|
|
StorageDead(_14);
|
2023-06-06 08:47:00 -05:00
|
|
|
goto -> bb1;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
2023-05-21 05:33:03 -05:00
|
|
|
}
|