]>
Commit | Line | Data |
---|---|---|
1 | #![feature(box_patterns)] | |
2 | #![feature(box_syntax)] | |
3 | ||
4 | enum A { B, C } | |
5 | ||
6 | fn main() { | |
7 | match (true, false) { | |
8 | A::B => (), | |
9 | //~^ ERROR mismatched types | |
10 | //~| expected tuple, found enum `A` | |
11 | //~| expected tuple `(bool, bool)` | |
12 | //~| found enum `A` | |
13 | _ => () | |
14 | } | |
15 | ||
16 | match (true, false) { | |
17 | (true, false, false) => () | |
18 | //~^ ERROR mismatched types | |
19 | //~| expected a tuple with 2 elements, found one with 3 elements | |
20 | //~| expected tuple `(bool, bool)` | |
21 | //~| found tuple `(_, _, _)` | |
22 | } | |
23 | ||
24 | match (true, false) { | |
25 | (true, false, false) => () | |
26 | //~^ ERROR mismatched types | |
27 | //~| expected a tuple with 2 elements, found one with 3 elements | |
28 | //~| expected tuple `(bool, bool)` | |
29 | //~| found tuple `(_, _, _)` | |
30 | } | |
31 | ||
32 | match (true, false) { | |
33 | box (true, false) => () | |
34 | //~^ ERROR mismatched types | |
35 | //~| expected tuple `(bool, bool)` | |
36 | //~| found struct `Box<_>` | |
37 | } | |
38 | ||
39 | match (true, false) { | |
40 | &(true, false) => () | |
41 | //~^ ERROR mismatched types | |
42 | //~| expected tuple, found reference | |
43 | //~| expected tuple `(bool, bool)` | |
44 | //~| found reference `&_` | |
45 | } | |
46 | ||
47 | ||
48 | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` | |
49 | ('c', 'd'), | |
50 | ('e', 'f')]; | |
51 | ||
52 | for &(x,y) in &v {} // should be OK | |
53 | ||
54 | // Make sure none of the errors above were fatal | |
55 | let x: char = true; //~ ERROR mismatched types | |
56 | //~| expected `char`, found `bool` | |
57 | } |