-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
1 parent
ac4379f
commit 33d7fad
Showing
2 changed files
with
17 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// build-fail | ||
|
||
fn main() { | ||
let xs: [i32; 5] = [1, 2, 3, 4, 5]; | ||
let _ = &xs; | ||
let _ = xs[7]; //~ 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,10 @@ | ||
error: this operation will panic at runtime | ||
--> $DIR/unconditional_panic_98444.rs:6:13 | ||
| | ||
LL | let _ = xs[7]; | ||
| ^^^^^ index out of bounds: the length is 5 but the index is 7 | ||
| | ||
= note: `#[deny(unconditional_panic)]` on by default | ||
|
||
error: aborting due to previous error | ||
|