Skip to content

Commit 33d7fad

Browse files
Add regression test for 98444
1 parent ac4379f commit 33d7fad

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// build-fail
2+
3+
fn main() {
4+
let xs: [i32; 5] = [1, 2, 3, 4, 5];
5+
let _ = &xs;
6+
let _ = xs[7]; //~ ERROR: this operation will panic at runtime [unconditional_panic]
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: this operation will panic at runtime
2+
--> $DIR/unconditional_panic_98444.rs:6:13
3+
|
4+
LL | let _ = xs[7];
5+
| ^^^^^ index out of bounds: the length is 5 but the index is 7
6+
|
7+
= note: `#[deny(unconditional_panic)]` on by default
8+
9+
error: aborting due to previous error
10+

0 commit comments

Comments
 (0)