Add regression test for 98444

This commit is contained in:
Albert Larsan 2023-03-06 13:41:07 +00:00
parent ac4379fea9
commit 33d7fad7e5
No known key found for this signature in database
GPG Key ID: 92709B88BB8F13EA
2 changed files with 17 additions and 0 deletions

View File

@ -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]
}

View File

@ -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