summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-pat-enum.rs
blob: 7f9c5544d0bd1617e5f9e7df4d778bdf6d3116f9 (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
// run-pass
#![allow(dead_code)]
// ignore-pretty issue #37199

fn match_ref(v: Option<isize>) -> isize {
    match v {
      Some(ref i) => {
        *i
      }
      None => {0}
    }
}

fn match_ref_unused(v: Option<isize>) {
    match v {
      Some(_) => {}
      None => {}
    }
}

fn impure(_i: isize) {
}

fn match_imm_reg(v: &Option<isize>) {
    match *v {
      Some(ref i) => {impure(*i)} // OK because immutable
      None => {}
    }
}

fn match_mut_reg(v: &mut Option<isize>) {
    match *v {
      Some(ref i) => {impure(*i)} // OK, frozen
      None => {}
    }
}

pub fn main() {
}