]> git.lizzy.rs Git - rust.git/blob - tests/ui/binding/borrowed-ptr-pattern-option.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / binding / borrowed-ptr-pattern-option.rs
1 // run-pass
2
3 fn select<'r>(x: &'r Option<isize>, y: &'r Option<isize>) -> &'r Option<isize> {
4     match (x, y) {
5         (&None, &None) => x,
6         (&Some(_), _) => x,
7         (&None, &Some(_)) => y
8     }
9 }
10
11 pub fn main() {
12     let x = None;
13     let y = Some(3);
14     assert_eq!(select(&x, &y).unwrap(), 3);
15 }