File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ fn main() {
5
5
//~^ ERROR this operation will panic at runtime [unconditional_panic]
6
6
7
7
// 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 ] ;
9
12
//~^ ERROR this operation will panic at runtime [unconditional_panic]
10
13
}
Original file line number Diff line number Diff line change @@ -9,8 +9,14 @@ LL | let _n = [64][200];
9
9
error: this operation will panic at runtime
10
10
--> $DIR/index-bounds.rs:8:14
11
11
|
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
14
14
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
16
22
You can’t perform that action at this time.
0 commit comments