]>
Commit | Line | Data |
---|---|---|
1a4d82fc | 1 | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT |
223e47cc LB |
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 | ||
1a4d82fc JJ |
11 | // ignore-pretty |
12 | ||
c34b1796 | 13 | fn match_ref(v: Option<isize>) -> isize { |
223e47cc LB |
14 | match v { |
15 | Some(ref i) => { | |
16 | *i | |
17 | } | |
18 | None => {0} | |
19 | } | |
20 | } | |
21 | ||
c34b1796 | 22 | fn match_ref_unused(v: Option<isize>) { |
223e47cc LB |
23 | match v { |
24 | Some(_) => {} | |
25 | None => {} | |
26 | } | |
27 | } | |
28 | ||
c34b1796 | 29 | fn impure(_i: isize) { |
223e47cc LB |
30 | } |
31 | ||
c34b1796 | 32 | fn match_imm_reg(v: &Option<isize>) { |
223e47cc LB |
33 | match *v { |
34 | Some(ref i) => {impure(*i)} // OK because immutable | |
35 | None => {} | |
36 | } | |
37 | } | |
38 | ||
c34b1796 | 39 | fn match_mut_reg(v: &mut Option<isize>) { |
970d7e83 LB |
40 | match *v { |
41 | Some(ref i) => {impure(*i)} // OK, frozen | |
42 | None => {} | |
43 | } | |
44 | } | |
45 | ||
1a4d82fc | 46 | pub fn main() { |
223e47cc | 47 | } |