Skip to content

Commit

Permalink
tests with fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Luv-Ray committed Jun 1, 2024
1 parent f0956a5 commit 00a1ef2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion tests/ui/indexing/index-bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ fn main() {
//~^ ERROR this operation will panic at runtime [unconditional_panic]

// issue #121126, test index value between 0xFFFF_FF00 and u32::MAX
let _n = [64][4_294_967_295];
let _n = [64][u32::MAX as usize - 1];
//~^ ERROR this operation will panic at runtime [unconditional_panic]

let _n = [64][u32::MAX as usize + 1];
//~^ ERROR this operation will panic at runtime [unconditional_panic]
}
12 changes: 9 additions & 3 deletions tests/ui/indexing/index-bounds.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ LL | let _n = [64][200];
error: this operation will panic at runtime
--> $DIR/index-bounds.rs:8:14
|
LL | let _n = [64][4_294_967_295];
| ^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967295
LL | let _n = [64][u32::MAX as usize - 1];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967294

error: aborting due to 2 previous errors
error: this operation will panic at runtime
--> $DIR/index-bounds.rs:11:14
|
LL | let _n = [64][u32::MAX as usize + 1];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967296

error: aborting due to 3 previous errors

0 comments on commit 00a1ef2

Please sign in to comment.