rust/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.4 KiB
Diff
Raw Normal View History

2021-06-20 09:09:42 -05:00
- // MIR for `bound` before LowerSliceLenCalls
+ // MIR for `bound` after LowerSliceLenCalls
fn bound(_1: usize, _2: &[u8]) -> u8 {
2023-06-06 08:47:00 -05:00
debug index => _1;
debug slice => _2;
let mut _0: u8;
let mut _3: bool;
let mut _4: usize;
let mut _5: usize;
let mut _6: &[u8];
let _7: usize;
let mut _8: usize;
let mut _9: bool;
2021-06-20 09:09:42 -05:00
bb0: {
2023-06-06 08:47:00 -05:00
StorageLive(_3);
StorageLive(_4);
_4 = _1;
StorageLive(_5);
StorageLive(_6);
_6 = &(*_2);
- _5 = core::slice::<impl [u8]>::len(move _6) -> [return: bb1, unwind unreachable];
+ _5 = Len((*_6));
+ goto -> bb1;
2021-06-20 09:09:42 -05:00
}
bb1: {
2023-06-06 08:47:00 -05:00
StorageDead(_6);
_3 = Lt(move _4, move _5);
switchInt(move _3) -> [0: bb4, otherwise: bb2];
2021-06-20 09:09:42 -05:00
}
bb2: {
StorageDead(_5);
StorageDead(_4);
2023-06-06 08:47:00 -05:00
StorageLive(_7);
_7 = _1;
_8 = Len((*_2));
_9 = Lt(_7, _8);
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> [success: bb3, unwind unreachable];
2021-06-20 09:09:42 -05:00
}
bb3: {
2023-06-06 08:47:00 -05:00
_0 = (*_2)[_7];
StorageDead(_7);
goto -> bb5;
2021-06-20 09:09:42 -05:00
}
bb4: {
StorageDead(_5);
StorageDead(_4);
2023-06-06 08:47:00 -05:00
_0 = const 42_u8;
goto -> bb5;
2021-06-20 09:09:42 -05:00
}
bb5: {
2023-06-06 08:47:00 -05:00
StorageDead(_3);
return;
2021-06-20 09:09:42 -05:00
}
}