summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-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_slice_len.bound.LowerSliceLenCalls.panic-abort.diff')
-rw-r--r--tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
new file mode 100644
index 000000000..70b33fb70
--- /dev/null
+++ b/tests/mir-opt/lower_slice_len.bound.LowerSliceLenCalls.panic-abort.diff
@@ -0,0 +1,60 @@
+- // MIR for `bound` before LowerSliceLenCalls
++ // MIR for `bound` after LowerSliceLenCalls
+
+ fn bound(_1: usize, _2: &[u8]) -> 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 _7: usize;
+ let mut _8: usize;
+ let mut _9: bool;
+
+ bb0: {
+ 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;
+ }
+
+ bb1: {
+ StorageDead(_6);
+ _3 = Lt(move _4, move _5);
+ StorageDead(_5);
+ StorageDead(_4);
+ switchInt(move _3) -> [0: bb4, otherwise: bb2];
+ }
+
+ bb2: {
+ 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];
+ }
+
+ bb3: {
+ _0 = (*_2)[_7];
+ StorageDead(_7);
+ goto -> bb5;
+ }
+
+ bb4: {
+ _0 = const 42_u8;
+ goto -> bb5;
+ }
+
+ bb5: {
+ StorageDead(_3);
+ return;
+ }
+ }
+