mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
39 lines
571 B
Rust
39 lines
571 B
Rust
// run-pass
|
|
#![allow(dead_code)]
|
|
|
|
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() {
|
|
}
|