summary refs log tree commit diff
path: root/src/test/compile-fail/resolve-inconsistent-binding-mode.rs
blob: e806bd6a63750f5520cc53835dbe78e6491dd33d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
enum opts {
    a(int), b(int), c(int)
}

fn matcher1(x: opts) {
    match x {
      a(ref i) | b(copy i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
      c(_) => {}
    }
}

fn matcher2(x: opts) {
    match x {
      a(ref i) | b(i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
      c(_) => {}
    }
}

fn matcher3(x: opts) {
    match x {
      a(ref mut i) | b(ref const i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
      c(_) => {}
    }
}

fn matcher4(x: opts) {
    match x {
      a(ref mut i) | b(ref i) => {} //~ ERROR variable `i` is bound with different mode in pattern #2 than in pattern #1
      c(_) => {}
    }
}


fn matcher5(x: opts) {
    match x {
      a(ref i) | b(ref i) => {}
      c(_) => {}
    }
}

fn main() {}