2022-09-04 22:00:31 -05:00
|
|
|
// MIR for `foo` after built
|
2022-08-13 10:13:20 -05:00
|
|
|
|
|
|
|
fn foo(_1: Box<[T]>) -> T {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug it => _1;
|
|
|
|
let mut _0: T;
|
|
|
|
let _2: T;
|
|
|
|
let mut _3: &T;
|
|
|
|
let _4: usize;
|
|
|
|
let mut _5: usize;
|
|
|
|
let mut _6: bool;
|
2022-08-13 10:13:20 -05:00
|
|
|
scope 1 {
|
2023-06-06 08:47:00 -05:00
|
|
|
debug f => _2;
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb0: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageLive(_2);
|
|
|
|
StorageLive(_3);
|
|
|
|
StorageLive(_4);
|
|
|
|
_4 = const 0_usize;
|
|
|
|
_5 = Len((*_1));
|
|
|
|
_6 = Lt(_4, _5);
|
|
|
|
assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind: bb5];
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb1: {
|
2023-06-06 08:47:00 -05:00
|
|
|
_3 = &(*_1)[_4];
|
|
|
|
_2 = <T as Clone>::clone(move _3) -> [return: bb2, unwind: bb5];
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb2: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageDead(_3);
|
|
|
|
FakeRead(ForLet(None), _2);
|
|
|
|
StorageDead(_4);
|
|
|
|
_0 = move _2;
|
|
|
|
drop(_2) -> [return: bb3, unwind: bb5];
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb3: {
|
2023-06-06 08:47:00 -05:00
|
|
|
StorageDead(_2);
|
|
|
|
drop(_1) -> [return: bb4, unwind: bb6];
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb4: {
|
2023-06-06 08:47:00 -05:00
|
|
|
return;
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb5 (cleanup): {
|
2023-06-06 08:47:00 -05:00
|
|
|
drop(_1) -> [return: bb6, unwind terminate];
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bb6 (cleanup): {
|
2023-06-06 08:47:00 -05:00
|
|
|
resume;
|
2022-08-13 10:13:20 -05:00
|
|
|
}
|
|
|
|
}
|