How the following code works if rust cannot have a mutable reference while we have an immutable one to the same value?
fn main() { let mut s = String::from(“hello”); let r1 = &s; // immutable reference let _r2 = &s; // immutable reference println!(“{r1}”); // println!(“{r2}”); let r3 = &mut s; // mutable reference, but it should throw compilation error // as _r2 is not out of scope yet. println!(“{r3}”); } Expected it to not work […]