forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
32 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//@ build-fail | ||
|
||
fn main() { | ||
let _n = [64][200]; | ||
//~^ ERROR this operation will panic at runtime [unconditional_panic] | ||
|
||
// issue #121126, test index value between 0xFFFF_FF00 and u32::MAX | ||
let _n = [64][u32::MAX as usize - 1]; | ||
//~^ ERROR this operation will panic at runtime [unconditional_panic] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: this operation will panic at runtime | ||
--> $DIR/index-bounds.rs:4:14 | ||
| | ||
LL | let _n = [64][200]; | ||
| ^^^^^^^^^ index out of bounds: the length is 1 but the index is 200 | ||
| | ||
= note: `#[deny(unconditional_panic)]` on by default | ||
|
||
error: this operation will panic at runtime | ||
--> $DIR/index-bounds.rs:8:14 | ||
| | ||
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 | ||
|