fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
722 B31 linesraw
1// Regression test for #87017.
2
3// run-rustfix
4
5fn main() {
6    fn foo() -> Vec<i32> { vec![1, 2, 3] }
7
8    if let [_, _, _] = foo()[..] {}
9    //~^ ERROR: expected an array or slice
10    //~| HELP: consider slicing here
11
12    if let [] = &foo()[..] {}
13    //~^ ERROR: expected an array or slice
14    //~| HELP: consider slicing here
15
16    if let [] = foo()[..] {}
17    //~^ ERROR: expected an array or slice
18    //~| HELP: consider slicing here
19
20    let v = vec![];
21    match &v[..] {
22    //~^ HELP: consider slicing here
23        [5] => {}
24        //~^ ERROR: expected an array or slice
25        _ => {}
26    }
27
28    let [..] = vec![1, 2, 3][..];
29    //~^ ERROR: expected an array or slice
30    //~| HELP: consider slicing here
31}