| - // MIR for `on_assert` before SsaRangePropagation | |
| + // MIR for `on_assert` after SsaRangePropagation | |
| fn on_assert(_1: usize, _2: &[u8]) -> u8 { | |
| debug i => _1; | |
| debug v => _2; | |
| let mut _0: u8; | |
| let _3: (); | |
| let mut _4: bool; | |
| let mut _5: usize; | |
| let mut _6: usize; | |
| let mut _7: &[u8]; | |
| let mut _8: !; | |
| let _9: usize; | |
| let mut _10: usize; | |
| let mut _11: bool; | |
| scope 1 (inlined core::slice::<impl [u8]>::len) { | |
| scope 2 (inlined std::ptr::metadata::<[u8]>) { | |
| } | |
| } | |
| bb0: { | |
| StorageLive(_3); | |
| nop; | |
| StorageLive(_5); | |
| _5 = copy _1; | |
| nop; | |
| StorageLive(_7); | |
| _7 = &(*_2); | |
| _6 = PtrMetadata(copy _2); | |
| StorageDead(_7); | |
| _4 = Lt(copy _1, copy _6); | |
| switchInt(copy _4) -> [0: bb2, otherwise: bb1]; | |
| } | |
| bb1: { | |
| nop; | |
| StorageDead(_5); | |
| _3 = const (); | |
| nop; | |
| StorageDead(_3); | |
| StorageLive(_9); | |
| _9 = copy _1; | |
| _10 = copy _6; | |
| - _11 = copy _4; | |
| - assert(copy _4, "index out of bounds: the length is {} but the index is {}", copy _6, copy _1) -> [success: bb3, unwind unreachable]; | |
| + _11 = const true; | |
| + assert(const true, "index out of bounds: the length is {} but the index is {}", copy _6, copy _1) -> [success: bb3, unwind unreachable]; | |
| } | |
| bb2: { | |
| nop; | |
| StorageDead(_5); | |
| StorageLive(_8); | |
| _8 = panic(const "assertion failed: i < v.len()") -> unwind unreachable; | |
| } | |
| bb3: { | |
| _0 = copy (*_2)[_1]; | |
| StorageDead(_9); | |
| return; | |
| } | |
| } | |
| ALLOC0 (size: 29, align: 1) { | |
| 0x00 │ 61 73 73 65 72 74 69 6f 6e 20 66 61 69 6c 65 64 │ assertion failed | |
| 0x10 │ 3a 20 69 20 3c 20 76 2e 6c 65 6e 28 29 │ : i < v.len() | |
| } | |