Ownership Rules Example
fn main() { let ref a; { // Value allocated on heap let mut s = String::from("Hello"); s.push_str(", world!"); println!("s is {}", s); a = &s; } // s is dropped here // Uncomment to see the error // println!("a is {}", a); { let x = 1; println!("x is {}", x); } // x is dropped here // Uncomment to see the error // println!("x is {}", x); }