mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
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
This commit is contained in:
commit
567cab93d5
7
tests/ui/lint/unconditional_panic_98444.rs
Normal file
7
tests/ui/lint/unconditional_panic_98444.rs
Normal 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]
|
||||
}
|
10
tests/ui/lint/unconditional_panic_98444.stderr
Normal file
10
tests/ui/lint/unconditional_panic_98444.stderr
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user