error[E0515]: cannot return reference to local variable `s` --> src/lib.rs:3:5 | 3 | &s | ^^ returns a reference to data owned by the current function
error[E0106]: missing lifetime specifier --> src/lib.rs:1:18 | 1 | fn producer() -> &str { | ^ expected named lifetime parameter |
&str
'static
s
s1
s2
error: lifetime may not live long enough --> src/lib.rs:2:5 | 1 | fn first_three_of_each<'a, 'b>(s1: &'a str, s2: &'b str) -> (&'a str, &'b str) { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here 2 | (&s1[0..3], &s1[0..3]) | ^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` | = help: consider adding the following bound: `'a: 'b`
error[E0597]: `amsterdam` does not live long enough --> src/main.rs:10:29 | 6 | let amsterdam = format!("AMS Amsterdam"); | --------- binding `amsterdam` declared here ... 10 | first_three_of_each(&amsterdam, &denver) | --------------------^^^^^^^^^^---------- | | | | | borrowed value does not live long enough | argument requires that `amsterdam` is borrowed for `'static` ... 14 | } | - `amsterdam` dropped here while still borrowed