diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff')
-rw-r--r-- | tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff new file mode 100644 index 000000000..e2de18452 --- /dev/null +++ b/tests/mir-opt/lower_array_len.array_bound_mut.NormalizeArrayLen.panic-abort.diff @@ -0,0 +1,77 @@ +- // MIR for `array_bound_mut` before NormalizeArrayLen ++ // MIR for `array_bound_mut` after NormalizeArrayLen + + fn array_bound_mut(_1: usize, _2: &mut [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; + let _11: usize; + let mut _12: usize; + let mut _13: 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); + StorageDead(_5); + StorageDead(_4); + switchInt(move _3) -> [0: bb4, otherwise: bb2]; + } + + bb2: { + 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 -> bb6; + } + + bb4: { + StorageLive(_11); + _11 = const 0_usize; + _12 = Len((*_2)); + _13 = Lt(_11, _12); + assert(move _13, "index out of bounds: the length is {} but the index is {}", move _12, _11) -> [success: bb5, unwind unreachable]; + } + + bb5: { + (*_2)[_11] = const 42_u8; + StorageDead(_11); + _0 = const 42_u8; + goto -> bb6; + } + + bb6: { + StorageDead(_3); + return; + } + } + |