diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-11-01 14:12:25 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-01 14:12:25 +0530 |
| commit | 94241e7eaf45f681d3629286c810bb3050c6114c (patch) | |
| tree | a7f6805e6e3fdebe975a4c012177947abb035b73 /src/test/codegen | |
| parent | 43634675f63c3d3cdf8234e2ec264e7327aa6b39 (diff) | |
| parent | a1672ad5b82755b94c0a72038f50b4ba8c25fe81 (diff) | |
| download | rust-94241e7eaf45f681d3629286c810bb3050c6114c.tar.gz rust-94241e7eaf45f681d3629286c810bb3050c6114c.zip | |
Rollup merge of #103584 - ouz-a:issue-102303, r=oli-obk
Remove bounds check when array is indexed by enum As the title says, this reverts the behavior introduced with 1.64. Fixes #102303 r? `@oli-obk`
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/enum-bounds-check-derived-idx.rs | 6 | ||||
| -rw-r--r-- | src/test/codegen/enum-bounds-check-issue-13926.rs | 3 | ||||
| -rw-r--r-- | src/test/codegen/enum-bounds-check.rs | 3 |
3 files changed, 4 insertions, 8 deletions
diff --git a/src/test/codegen/enum-bounds-check-derived-idx.rs b/src/test/codegen/enum-bounds-check-derived-idx.rs index fe02aeb5f62..aa66c2ed08e 100644 --- a/src/test/codegen/enum-bounds-check-derived-idx.rs +++ b/src/test/codegen/enum-bounds-check-derived-idx.rs @@ -12,15 +12,13 @@ pub enum Bar { // CHECK-LABEL: @lookup_inc #[no_mangle] pub fn lookup_inc(buf: &[u8; 5], f: Bar) -> u8 { - // FIXME: panic check can be removed by adding the assumes back after https://github.com/rust-lang/rust/pull/98332 - // CHECK: panic_bounds_check + // CHECK-NOT: panic_bounds_check buf[f as usize + 1] } // CHECK-LABEL: @lookup_dec #[no_mangle] pub fn lookup_dec(buf: &[u8; 5], f: Bar) -> u8 { - // FIXME: panic check can be removed by adding the assumes back after https://github.com/rust-lang/rust/pull/98332 - // CHECK: panic_bounds_check + // CHECK-NOT: panic_bounds_check buf[f as usize - 1] } diff --git a/src/test/codegen/enum-bounds-check-issue-13926.rs b/src/test/codegen/enum-bounds-check-issue-13926.rs index 1aec41d5441..b26945bc549 100644 --- a/src/test/codegen/enum-bounds-check-issue-13926.rs +++ b/src/test/codegen/enum-bounds-check-issue-13926.rs @@ -13,7 +13,6 @@ pub enum Exception { // CHECK-LABEL: @access #[no_mangle] pub fn access(array: &[usize; 12], exc: Exception) -> usize { - // FIXME: panic check can be removed by adding the assumes back after https://github.com/rust-lang/rust/pull/98332 - // CHECK: panic_bounds_check + // CHECK-NOT: panic_bounds_check array[(exc as u8 - 4) as usize] } diff --git a/src/test/codegen/enum-bounds-check.rs b/src/test/codegen/enum-bounds-check.rs index f85c6817ded..17322d5911b 100644 --- a/src/test/codegen/enum-bounds-check.rs +++ b/src/test/codegen/enum-bounds-check.rs @@ -21,7 +21,6 @@ pub enum Bar { // CHECK-LABEL: @lookup_unmodified #[no_mangle] pub fn lookup_unmodified(buf: &[u8; 5], f: Bar) -> u8 { - // FIXME: panic check can be removed by adding the assumes back after https://github.com/rust-lang/rust/pull/98332 - // CHECK: panic_bounds_check + // CHECK-NOT: panic_bounds_check buf[f as usize] } |
