]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/pattern-slice-vec.fixed
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / suggestions / pattern-slice-vec.fixed
1 // Regression test for #87017.
2
3 // run-rustfix
4
5 fn 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 }