]>
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 | ||
11 | enum A { B, C } | |
12 | ||
13 | fn main() { | |
14 | match (true, false) { | |
15 | B => (), //~ ERROR expected `(bool,bool)` but found an enum or structure pattern | |
16 | _ => () | |
17 | } | |
18 | ||
19 | match (true, false) { | |
20 | (true, false, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found tuple (expected a tuple with 2 elements but found one with 3 elements) | |
21 | } | |
22 | ||
23 | match (true, false) { | |
24 | @(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an @-box pattern | |
25 | } | |
26 | ||
27 | match (true, false) { | |
28 | ~(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found a ~-box pattern | |
29 | } | |
30 | ||
31 | match (true, false) { | |
32 | &(true, false) => () //~ ERROR mismatched types: expected `(bool,bool)` but found an &-pointer pattern | |
33 | } | |
34 | ||
35 | ||
36 | let v = [('a', 'b') //~ ERROR expected function but found `(char,char)` | |
37 | ('c', 'd'), | |
38 | ('e', 'f')]; | |
39 | ||
40 | for v.iter().advance |&(x,y)| {} // should be OK | |
41 | ||
42 | // Make sure none of the errors above were fatal | |
43 | let x: char = true; //~ ERROR expected `char` but found `bool` | |
44 | } |