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