I was reading The Rust Programming Language book 2nd edition. In the Understanding Ownership chapter, page 95, it was saying that you can't have 2 mutable references.
But when I tried this:
fn main() {
let mut s = String::from("Hi, mom!");
let _r1 = &s;
let _r2 = &s;
let _r3 = &mut s;
let _r4 = &mut s;
}
It worked and compiled with no error.
Shouldn't it give me a compile error?