Here are two functions declare.
fn foo1() -> &str // illegal fn foo2() -> &'static str; // legal
I think when the Rust compiler meet with the first function declare, because there is no input, the return lifetime is the same with the lifetime of function caller, such as ‘a, all the variables’ lifetime in the
foo1 is smaller than 'a, so the compiler think this declare is wrong. But we can actually return a static string etc.
but the second can hold the same reason.
So what’s the design consideration in these ?
maybe the second one is convenient for us to return some const variable or static string ?