diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-12-01 20:14:04 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2024-12-03 11:05:45 -0800 |
| commit | 612adbb6bf88ecf549fb93cb1f4edcf793bca88e (patch) | |
| tree | 3f37a1552ccefe3df0da67281b5e060bcc2d3d21 /tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff | |
| parent | 490b2cc09860dd62a7595bb07364d71c12ce4e60 (diff) | |
| download | rust-612adbb6bf88ecf549fb93cb1f4edcf793bca88e.tar.gz rust-612adbb6bf88ecf549fb93cb1f4edcf793bca88e.zip | |
Bounds-check with PtrMetadata instead of Len in MIR
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff')
| -rw-r--r-- | tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff index 3299e300431..72c73137869 100644 --- a/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff +++ b/tests/mir-opt/lower_array_len.array_bound.GVN.panic-unwind.diff @@ -11,16 +11,14 @@ let mut _6: &[u8]; let mut _7: &[u8; N]; let _8: usize; - let mut _9: usize; - let mut _10: bool; + let mut _9: bool; bb0: { - StorageLive(_3); + nop; StorageLive(_4); _4 = copy _1; -- StorageLive(_5); -+ nop; + StorageLive(_5); StorageLive(_6); StorageLive(_7); _7 = &(*_2); @@ -40,16 +38,13 @@ } bb2: { -- StorageDead(_5); -+ nop; + StorageDead(_5); StorageDead(_4); StorageLive(_8); _8 = copy _1; -- _9 = Len((*_2)); -- _10 = Lt(copy _8, copy _9); -- assert(move _10, "index out of bounds: the length is {} but the index is {}", move _9, copy _8) -> [success: bb3, unwind continue]; -+ _9 = const N; -+ _10 = copy _3; +- _9 = Lt(copy _8, const N); +- assert(move _9, "index out of bounds: the length is {} but the index is {}", const N, copy _8) -> [success: bb3, unwind continue]; ++ _9 = copy _3; + assert(copy _3, "index out of bounds: the length is {} but the index is {}", const N, copy _1) -> [success: bb3, unwind continue]; } @@ -61,8 +56,7 @@ } bb4: { -- StorageDead(_5); -+ nop; + StorageDead(_5); StorageDead(_4); _0 = const 42_u8; goto -> bb5; |
