I'll get error when compiled: 'returns value referencing data owned by the current function'
here's the code:
fn return_static_str(a: &'static str, b: &'static str) -> &'static str {
format!("{} {}", a,b).as_str()
}
fn main() {
let s = return_static_str("Hello ", "World!");
}
using return as_ref()
get same issue.