]> git.lizzy.rs Git - rust.git/blob - tests/ui/rfcs/rfc-2005-default-binding-mode/ref-region.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / rfcs / rfc-2005-default-binding-mode / ref-region.rs
1 // run-pass
2 fn foo<'a, 'b>(x: &'a &'b Option<u32>) -> &'a u32 {
3     let x: &'a &'a Option<u32> = x;
4     match x {
5         Some(r) => {
6             let _: &u32 = r;
7             r
8         },
9         &None => panic!(),
10     }
11 }
12
13 pub fn main() {
14     let x = Some(5);
15     foo(&&x);
16 }