]> git.proxmox.com Git - rustc.git/blame_incremental - src/test/run-pass/borrowck-pat-enum.rs
Imported Upstream version 1.7.0+dfsg1
[rustc.git] / src / test / run-pass / borrowck-pat-enum.rs
... / ...
CommitLineData
1// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
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
11// ignore-pretty
12
13fn match_ref(v: Option<isize>) -> isize {
14 match v {
15 Some(ref i) => {
16 *i
17 }
18 None => {0}
19 }
20}
21
22fn match_ref_unused(v: Option<isize>) {
23 match v {
24 Some(_) => {}
25 None => {}
26 }
27}
28
29fn impure(_i: isize) {
30}
31
32fn match_imm_reg(v: &Option<isize>) {
33 match *v {
34 Some(ref i) => {impure(*i)} // OK because immutable
35 None => {}
36 }
37}
38
39fn match_mut_reg(v: &mut Option<isize>) {
40 match *v {
41 Some(ref i) => {impure(*i)} // OK, frozen
42 None => {}
43 }
44}
45
46pub fn main() {
47}