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-07-01 04:01:33 -05:00
|
|
|
let mut _4: usize;
|
|
|
|
let mut _7: std::option::Option<usize>;
|
|
|
|
let mut _10: isize;
|
|
|
|
let mut _12: usize;
|
|
|
|
let mut _13: bool;
|
|
|
|
let mut _15: &impl Fn(usize, &T);
|
|
|
|
let mut _16: (usize, &T);
|
|
|
|
let _17: ();
|
|
|
|
let mut _18: usize;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 1 {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug iter => std::ops::Range<usize>{ .0 => _4, .1 => _3, };
|
|
|
|
let _11: usize;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 2 {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug i => _11;
|
|
|
|
let _14: &T;
|
2023-05-16 07:24:38 -05:00
|
|
|
scope 3 {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug x => _14;
|
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-07-01 04:01:33 -05:00
|
|
|
debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
|
2023-06-06 08:47:00 -05:00
|
|
|
scope 6 (inlined <std::ops::Range<usize> as iter::range::RangeIteratorImpl>::spec_next) {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug self => &std::ops::Range<usize>{ .0 => _4, .1 => _3, };
|
|
|
|
let mut _6: bool;
|
|
|
|
let _8: usize;
|
|
|
|
let mut _9: usize;
|
2023-06-01 01:08:25 -05:00
|
|
|
scope 7 {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug old => _8;
|
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) {
|
2023-07-01 04:01:33 -05:00
|
|
|
debug self => &_4;
|
|
|
|
debug other => &_3;
|
|
|
|
let mut _5: 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-07-01 04:01:33 -05:00
|
|
|
debug self => std::ops::Range<usize>{ .0 => _18, .1 => _3, };
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_3 = Len((*_1));
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageLive(_4);
|
|
|
|
_4 = const 0_usize;
|
2023-06-06 08:47:00 -05:00
|
|
|
goto -> bb1;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageLive(_7);
|
2023-03-11 09:27:44 -06:00
|
|
|
StorageLive(_8);
|
|
|
|
StorageLive(_6);
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageLive(_5);
|
|
|
|
_5 = _4;
|
|
|
|
_6 = Lt(move _5, _3);
|
|
|
|
StorageDead(_5);
|
|
|
|
switchInt(move _6) -> [0: bb2, otherwise: bb3];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb2: {
|
2023-07-01 04:01:33 -05:00
|
|
|
_7 = Option::<usize>::None;
|
2023-06-06 08:47:00 -05:00
|
|
|
goto -> bb5;
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb3: {
|
2023-07-01 04:01:33 -05:00
|
|
|
_8 = _4;
|
|
|
|
StorageLive(_9);
|
|
|
|
_9 = <usize as Step>::forward_unchecked(_8, 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-07-01 04:01:33 -05:00
|
|
|
_4 = move _9;
|
|
|
|
StorageDead(_9);
|
|
|
|
_7 = Option::<usize>::Some(_8);
|
2023-06-06 08:47:00 -05:00
|
|
|
goto -> bb5;
|
2023-06-03 07:23:32 -05:00
|
|
|
}
|
|
|
|
|
2023-05-16 07:24:38 -05:00
|
|
|
bb5: {
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageDead(_6);
|
2023-03-11 09:27:44 -06:00
|
|
|
StorageDead(_8);
|
2023-07-01 04:01:33 -05:00
|
|
|
_10 = discriminant(_7);
|
|
|
|
switchInt(move _10) -> [0: bb6, 1: bb8, otherwise: bb11];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb6: {
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageDead(_7);
|
|
|
|
StorageDead(_4);
|
2023-06-23 11:53:09 -05:00
|
|
|
drop(_2) -> [return: bb7, unwind continue];
|
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-07-01 04:01:33 -05:00
|
|
|
_11 = ((_7 as Some).0: usize);
|
|
|
|
_12 = Len((*_1));
|
|
|
|
_13 = Lt(_11, _12);
|
|
|
|
assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb9, unwind: bb12];
|
2023-06-01 01:08:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb9: {
|
2023-07-01 04:01:33 -05:00
|
|
|
_14 = &(*_1)[_11];
|
|
|
|
StorageLive(_15);
|
|
|
|
_15 = &_2;
|
|
|
|
StorageLive(_16);
|
|
|
|
_16 = (_11, _14);
|
|
|
|
_17 = <impl Fn(usize, &T) as Fn<(usize, &T)>>::call(move _15, move _16) -> [return: bb10, unwind: bb12];
|
2023-05-16 07:24:38 -05:00
|
|
|
}
|
|
|
|
|
2023-06-03 07:23:32 -05:00
|
|
|
bb10: {
|
2023-07-01 04:01:33 -05:00
|
|
|
StorageDead(_16);
|
|
|
|
StorageDead(_15);
|
|
|
|
StorageDead(_7);
|
2023-06-06 08:47:00 -05:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|