Lifetime Elision Example
fn main() { println!("{}", foo("hello")); println!("{}", foo_2("hello")); } // First rule // fn foo<'a,'b>(a: &'a str) -> &'b str { // Second rule // fn foo<'a>(a: &'a str) -> &'a str { fn foo(a: &str) -> &str { a } // Manual settings: 'a must outlive 'b fn foo_2<'a: 'b, 'b>(a: &'a str) -> &'b str { a }