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