]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/resolve-inconsistent-binding-mode.rs
Make name resolution errors non-fatal
[rust.git] / src / test / compile-fail / resolve-inconsistent-binding-mode.rs
1 // Copyright 2012 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 opts {
12     a(isize), b(isize), c(isize)
13 }
14
15 fn matcher1(x: opts) {
16     match x {
17       opts::a(ref i) | opts::b(i) => {}
18       //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
19       //~^^ ERROR mismatched types
20       opts::c(_) => {}
21     }
22 }
23
24 fn matcher2(x: opts) {
25     match x {
26       opts::a(ref i) | opts::b(i) => {}
27       //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
28       //~^^ ERROR mismatched types
29       opts::c(_) => {}
30     }
31 }
32
33 fn matcher4(x: opts) {
34     match x {
35       opts::a(ref mut i) | opts::b(ref i) => {}
36       //~^ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
37       //~^^ ERROR mismatched types
38       opts::c(_) => {}
39     }
40 }
41
42
43 fn matcher5(x: opts) {
44     match x {
45       opts::a(ref i) | opts::b(ref i) => {}
46       opts::c(_) => {}
47     }
48 }
49
50 fn main() {}