Medium
Returning a reference to a local with an explicit lifetime annotation
What happens when this program is compiled?
main.rs
fn get_name<'a>() -> &'a String {
let name = String::from("Alice");
&name
}
fn main() {
let r = get_name();
println!("{}", r);
}3 of 53 in Rust