diff options
| author | bors <bors@rust-lang.org> | 2024-05-19 08:28:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-05-19 08:28:03 +0000 |
| commit | 9f4b6517208d77556a919789ed285e0c6f67bbb5 (patch) | |
| tree | ed59ba0a778df31624015f2719f19f215d36e429 /tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff | |
| parent | 143661a7f0df8b456f9caffbb1fabafcd4407db0 (diff) | |
| parent | c944b01b81abe1f28f3f8dd9bf883bd66facc7de (diff) | |
| download | rust-9f4b6517208d77556a919789ed285e0c6f67bbb5.tar.gz rust-9f4b6517208d77556a919789ed285e0c6f67bbb5.zip | |
Auto merge of #17259 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff')
| -rw-r--r-- | tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff new file mode 100644 index 00000000000..5242c5f6afd --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_bound.NormalizeArrayLen.panic-abort.diff @@ -0,0 +1,66 @@ +- // MIR for `array_bound` before NormalizeArrayLen ++ // MIR for `array_bound` after NormalizeArrayLen + + fn array_bound(_1: usize, _2: &[u8; N]) -> u8 { + 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 mut _7: &[u8; N]; + let _8: usize; + let mut _9: usize; + let mut _10: bool; + + bb0: { + StorageLive(_3); + StorageLive(_4); + _4 = _1; + StorageLive(_5); + StorageLive(_6); + StorageLive(_7); + _7 = &(*_2); + _6 = move _7 as &[u8] (PointerCoercion(Unsize)); + StorageDead(_7); +- _5 = Len((*_6)); ++ _5 = const N; + goto -> bb1; + } + + bb1: { + StorageDead(_6); + _3 = Lt(move _4, move _5); + switchInt(move _3) -> [0: bb4, otherwise: bb2]; + } + + bb2: { + StorageDead(_5); + StorageDead(_4); + StorageLive(_8); + _8 = _1; + _9 = Len((*_2)); + _10 = Lt(_8, _9); + assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, _8) -> [success: bb3, unwind unreachable]; + } + + bb3: { + _0 = (*_2)[_8]; + StorageDead(_8); + goto -> bb5; + } + + bb4: { + StorageDead(_5); + StorageDead(_4); + _0 = const 42_u8; + goto -> bb5; + } + + bb5: { + StorageDead(_3); + return; + } + } + |
