]>
Commit | Line | Data |
---|---|---|
970d7e83 LB |
1 | // Copyright 2013 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
1a4d82fc JJ |
11 | #![feature(box_syntax)] |
12 | ||
970d7e83 LB |
13 | enum A { B, C } |
14 | ||
15 | fn main() { | |
16 | match (true, false) { | |
1a4d82fc JJ |
17 | A::B => (), |
18 | //~^ ERROR mismatched types: expected `(bool, bool)`, found `A` (expected tuple, found enum A) | |
970d7e83 LB |
19 | _ => () |
20 | } | |
21 | ||
22 | match (true, false) { | |
1a4d82fc JJ |
23 | (true, false, false) => () |
24 | //~^ ERROR mismatched types: expected `(bool, bool)`, found `(_, _, _)` | |
970d7e83 LB |
25 | } |
26 | ||
27 | match (true, false) { | |
1a4d82fc JJ |
28 | (true, false, false) => () |
29 | //~^ ERROR (expected a tuple with 2 elements, found one with 3 elements) | |
970d7e83 LB |
30 | } |
31 | ||
32 | match (true, false) { | |
1a4d82fc JJ |
33 | box (true, false) => () |
34 | //~^ ERROR mismatched types: expected `(bool, bool)`, found `Box<_>` (expected tuple, found box) | |
970d7e83 LB |
35 | } |
36 | ||
37 | match (true, false) { | |
1a4d82fc JJ |
38 | &(true, false) => () |
39 | //~^ ERROR mismatched types: expected `(bool, bool)`, found `&_` (expected tuple, found &-ptr) | |
970d7e83 LB |
40 | } |
41 | ||
42 | ||
1a4d82fc | 43 | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` |
970d7e83 LB |
44 | ('c', 'd'), |
45 | ('e', 'f')]; | |
46 | ||
1a4d82fc | 47 | for &(x,y) in v.iter() {} // should be OK |
970d7e83 LB |
48 | |
49 | // Make sure none of the errors above were fatal | |
1a4d82fc | 50 | let x: char = true; //~ ERROR expected `char`, found `bool` |
970d7e83 | 51 | } |