]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-5100.rs
Rollup merge of #62337 - Mark-Simulacrum:fix-cpu-usage-script, r=alexcrichton
[rust.git] / src / test / ui / issues / issue-5100.rs
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 type `(bool, bool)`
11 //~| found type `A`
12 //~| expected tuple, found enum `A`
13         _ => ()
14     }
15
16     match (true, false) {
17         (true, false, false) => ()
18 //~^ ERROR mismatched types
19 //~| expected type `(bool, bool)`
20 //~| found type `(_, _, _)`
21 //~| expected a tuple with 2 elements, found one with 3 elements
22     }
23
24     match (true, false) {
25         (true, false, false) => ()
26 //~^ ERROR mismatched types
27 //~| expected type `(bool, bool)`
28 //~| found type `(_, _, _)`
29 //~| expected a tuple with 2 elements, found one with 3 elements
30     }
31
32     match (true, false) {
33         box (true, false) => ()
34 //~^ ERROR mismatched types
35 //~| expected type `(bool, bool)`
36 //~| found type `std::boxed::Box<_>`
37     }
38
39     match (true, false) {
40         &(true, false) => ()
41 //~^ ERROR mismatched types
42 //~| expected type `(bool, bool)`
43 //~| found type `&_`
44 //~| expected tuple, 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 }