Dangling References
fn main() { //let dangle = dangle(); let no_dangle = no_dangle(); println!("no_dangle is {}", no_dangle) } fn no_dangle() -> String { let s = String::from("hello"); s } // Uncomment to see error // fn dangle() -> &String { // let s = String::from("hello"); // &s // }