Skip to content

Commit 567cab9

Browse files
authored
Rollup merge of #108812 - albertlarsan68:test-98444, r=Nilstrieb
Add regression test for #98444 cc #108730 this will need to be changed to a `check-fail` test once it lands. Fixes #98444
2 parents 3279f7e + 33d7fad commit 567cab9

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)