Skip to content
Mathias Svensson edited this page Sep 15, 2015 · 2 revisions
fn foo<'b, 'a:'b>(x: &'a (i32, i32)) -> &'b i32 {
    &x.1
}

fn bar<'a, 'b: 'c, 'c>(y: &'a mut &'c i32, x: &'b i32) {
    *y = x;
}

fn baz<'a: 'c, 'b: 'c, 'c>(x: &'a i32, y: &'b i32, b: bool) -> &'c i32 {
    if b { x } else { y }
}

fn qux<'a, 'b:'d, 'c:'d, 'd>(x: &'a (&'b i32, &'c i32), b:bool) -> &'d i32 {
    if b { x.0 } else { x.1 }
}
Clone this wiki locally