]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-5100.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / issues / issue-5100.rs
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 #![feature(box_patterns)]
12 #![feature(box_syntax)]
13
14 enum A { B, C }
15
16 fn main() {
17     match (true, false) {
18         A::B => (),
19 //~^ ERROR mismatched types
20 //~| expected type `(bool, bool)`
21 //~| found type `A`
22 //~| expected tuple, found enum `A`
23         _ => ()
24     }
25
26     match (true, false) {
27         (true, false, false) => ()
28 //~^ ERROR mismatched types
29 //~| expected type `(bool, bool)`
30 //~| found type `(_, _, _)`
31 //~| expected a tuple with 2 elements, found one with 3 elements
32     }
33
34     match (true, false) {
35         (true, false, false) => ()
36 //~^ ERROR mismatched types
37 //~| expected type `(bool, bool)`
38 //~| found type `(_, _, _)`
39 //~| expected a tuple with 2 elements, found one with 3 elements
40     }
41
42     match (true, false) {
43         box (true, false) => ()
44 //~^ ERROR mismatched types
45 //~| expected type `(bool, bool)`
46 //~| found type `std::boxed::Box<_>`
47     }
48
49     match (true, false) {
50         &(true, false) => ()
51 //~^ ERROR mismatched types
52 //~| expected type `(bool, bool)`
53 //~| found type `&_`
54 //~| expected tuple, found reference
55     }
56
57
58     let v = [('a', 'b')   //~ ERROR expected function, found `(char, char)`
59              ('c', 'd'),
60              ('e', 'f')];
61
62     for &(x,y) in &v {} // should be OK
63
64     // Make sure none of the errors above were fatal
65     let x: char = true; //~  ERROR mismatched types
66                         //~| expected char, found bool
67 }