rust/src/test/run-pass/alt-value-binding-in-guard-3291.rs
2012-09-12 18:15:22 -07:00

14 lines
251 B
Rust

fn foo(x: Option<~int>, b: bool) -> int {
match x {
None => { 1 }
Some(copy x) if b => { *x }
Some(_) => { 0 }
}
}
fn main() {
foo(Some(~22), true);
foo(Some(~22), false);
foo(None, true);
foo(None, false);
}