]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-pat-enum.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / borrowck / borrowck-pat-enum.rs
1 // run-pass
2 #![allow(dead_code)]
3 // ignore-pretty issue #37199
4
5 fn match_ref(v: Option<isize>) -> isize {
6     match v {
7       Some(ref i) => {
8         *i
9       }
10       None => {0}
11     }
12 }
13
14 fn match_ref_unused(v: Option<isize>) {
15     match v {
16       Some(_) => {}
17       None => {}
18     }
19 }
20
21 fn impure(_i: isize) {
22 }
23
24 fn match_imm_reg(v: &Option<isize>) {
25     match *v {
26       Some(ref i) => {impure(*i)} // OK because immutable
27       None => {}
28     }
29 }
30
31 fn match_mut_reg(v: &mut Option<isize>) {
32     match *v {
33       Some(ref i) => {impure(*i)} // OK, frozen
34       None => {}
35     }
36 }
37
38 pub fn main() {
39 }