]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/match-ergonomics.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / suggestions / match-ergonomics.rs
1 fn main() {
2     let x = vec![1i32];
3     match &x[..] {
4         [&v] => {}, //~ ERROR mismatched types
5         _ => {},
6     }
7     match x {
8         [&v] => {}, //~ ERROR expected an array or slice
9         _ => {},
10     }
11     match &x[..] {
12         [v] => {},
13         _ => {},
14     }
15     match &x[..] {
16         &[v] => {},
17         _ => {},
18     }
19     match x {
20         [v] => {}, //~ ERROR expected an array or slice
21         _ => {},
22     }
23     let y = 1i32;
24     match &y {
25         &v => {},
26         _ => {},
27     }
28     match y {
29         &v => {}, //~ ERROR mismatched types
30         _ => {},
31     }
32     match &y {
33         v => {},
34         _ => {},
35     }
36     match y {
37         v => {},
38         _ => {},
39     }
40     if let [&v] = &x[..] {} //~ ERROR mismatched types
41 }