summary refs log tree commit diff
path: root/src/test/run-pass/borrowed-ptr-pattern-option.rs
blob: 9da88ff00068b6ff8ceea935281901ad4491e05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
fn select(x: &r/Option<int>, y: &r/Option<int>) -> &r/Option<int> {
    match (x, y) {
        (&None, &None) => x,
        (&Some(_), _) => x,
        (&None, &Some(_)) => y
    }
}

fn main() {
    let x = None;
    let y = Some(3);
    assert select(&x, &y).get() == 3;
}