Skip to content

Commit 00a1ef2

Browse files
committed
tests with fixed errors
1 parent f0956a5 commit 00a1ef2

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

tests/ui/indexing/index-bounds.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ fn main() {
55
//~^ ERROR this operation will panic at runtime [unconditional_panic]
66

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

tests/ui/indexing/index-bounds.stderr

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ LL | let _n = [64][200];
99
error: this operation will panic at runtime
1010
--> $DIR/index-bounds.rs:8:14
1111
|
12-
LL | let _n = [64][4_294_967_295];
13-
| ^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967295
12+
LL | let _n = [64][u32::MAX as usize - 1];
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 4294967294
1414

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

0 commit comments

Comments
 (0)