You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 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
+
enumA{B,C}
12
+
13
+
fnmain(){
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 `(bool,bool,bool)` (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.each |&(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`
0 commit comments