diff options
Diffstat (limited to 'tests/ui/suggestions/match-ergonomics.rs')
-rw-r--r-- | tests/ui/suggestions/match-ergonomics.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/ui/suggestions/match-ergonomics.rs b/tests/ui/suggestions/match-ergonomics.rs new file mode 100644 index 000000000..c4fc01469 --- /dev/null +++ b/tests/ui/suggestions/match-ergonomics.rs @@ -0,0 +1,41 @@ +fn main() { + let x = vec![1i32]; + match &x[..] { + [&v] => {}, //~ ERROR mismatched types + _ => {}, + } + match x { + [&v] => {}, //~ ERROR expected an array or slice + _ => {}, + } + match &x[..] { + [v] => {}, + _ => {}, + } + match &x[..] { + &[v] => {}, + _ => {}, + } + match x { + [v] => {}, //~ ERROR expected an array or slice + _ => {}, + } + let y = 1i32; + match &y { + &v => {}, + _ => {}, + } + match y { + &v => {}, //~ ERROR mismatched types + _ => {}, + } + match &y { + v => {}, + _ => {}, + } + match y { + v => {}, + _ => {}, + } + if let [&v] = &x[..] {} //~ ERROR mismatched types +} |