mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
32 lines
722 B
Rust
32 lines
722 B
Rust
// Regression test for #87017.
|
|
|
|
// run-rustfix
|
|
|
|
fn main() {
|
|
fn foo() -> Vec<i32> { vec![1, 2, 3] }
|
|
|
|
if let [_, _, _] = foo()[..] {}
|
|
//~^ ERROR: expected an array or slice
|
|
//~| HELP: consider slicing here
|
|
|
|
if let [] = &foo()[..] {}
|
|
//~^ ERROR: expected an array or slice
|
|
//~| HELP: consider slicing here
|
|
|
|
if let [] = foo()[..] {}
|
|
//~^ ERROR: expected an array or slice
|
|
//~| HELP: consider slicing here
|
|
|
|
let v = vec![];
|
|
match &v[..] {
|
|
//~^ HELP: consider slicing here
|
|
[5] => {}
|
|
//~^ ERROR: expected an array or slice
|
|
_ => {}
|
|
}
|
|
|
|
let [..] = vec![1, 2, 3][..];
|
|
//~^ ERROR: expected an array or slice
|
|
//~| HELP: consider slicing here
|
|
}
|