]> git.lizzy.rs Git - rust.git/blob - src/test/ui/resolve/resolve-inconsistent-binding-mode.rs
Rollup merge of #61207 - taiki-e:arbitrary_self_types-lifetime-elision-2, r=Centril
[rust.git] / src / test / ui / resolve / resolve-inconsistent-binding-mode.rs
1 enum Opts {
2     A(isize), B(isize), C(isize)
3 }
4
5 fn matcher1(x: Opts) {
6     match x {
7       Opts::A(ref i) | Opts::B(i) => {}
8       //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
9       //~^^ ERROR mismatched types
10       Opts::C(_) => {}
11     }
12 }
13
14 fn matcher2(x: Opts) {
15     match x {
16       Opts::A(ref i) | Opts::B(i) => {}
17       //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
18       //~^^ ERROR mismatched types
19       Opts::C(_) => {}
20     }
21 }
22
23 fn matcher4(x: Opts) {
24     match x {
25       Opts::A(ref mut i) | Opts::B(ref i) => {}
26       //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
27       //~^^ ERROR mismatched types
28       Opts::C(_) => {}
29     }
30 }
31
32
33 fn matcher5(x: Opts) {
34     match x {
35       Opts::A(ref i) | Opts::B(ref i) => {}
36       Opts::C(_) => {}
37     }
38 }
39
40 fn main() {}