fn no_dangle() -> String {
let s = String::from("hello");
s
}
This works without any problems. Ownership is moved out, and nothing is deallocated.
help: consider using the `'static` lifetime
|
5 | fn dangle() -> &'static i32 { // dangle returns a reference to a String