]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/issue-5100.rs
return &mut T from the arenas, not &T
[rust.git] / src / test / compile-fail / 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 enum A { B, C }
12
13 fn main() {
14     match (true, false) {
15         B => (),
16         //~^ ERROR mismatched types: expected `(bool,bool)`, found `A`
17         //         (expected tuple, found enum A)
18         _ => ()
19     }
20
21     match (true, false) {
22         (true, false, false) => ()
23         //~^ ERROR mismatched types: expected `(bool,bool)`,
24         //         found `(<generic #7>,<generic #8>,<generic #9>)`
25         //         (expected a tuple with 2 elements, found one with 3 elements)
26     }
27
28     match (true, false) {
29         box (true, false) => ()
30         //~^ ERROR mismatched types: expected `(bool,bool)`, found `Box<<generic #11>>`
31         //         (expected tuple, found box)
32     }
33
34     match (true, false) {
35         &(true, false) => ()
36         //~^ ERROR mismatched types: expected `(bool,bool)`, found `&<generic #15>`
37         //         (expected tuple, found &-ptr)
38     }
39
40
41     let v = [('a', 'b')   //~ ERROR expected function, found `(char,char)`
42              ('c', 'd'),
43              ('e', 'f')];
44
45     for &(x,y) in v.iter() {} // should be OK
46
47     // Make sure none of the errors above were fatal
48     let x: char = true; //~ ERROR expected `char`, found `bool`
49 }