Hi,
Out of interest going through this track, noticed some issues with the References section. While compilation error would be returned here
let s = String::from("hello");
let r1 = &s;
let r2 = &s;
// let r3 = &mut s; // This would be an error!
It would be a Cannot borrow immutable local variable
s as mutable
, not the referencing error. To get the actual reference compile error the code would have to be altered as
let mut s = String::from("hello");
let r1 = &s;
let r2 = &mut s;
println!("{:?}", r1);
Same applies to the previous example
let mut s = String::from("hello");
let r1 = &mut s;
// let r2 = &mut s;
It’d actually compile just ok, but if changed to
let mut s = String::from("hello");
let r1 = &mut s;
let r2 = &mut s;
*r1 = String::from("world");
then it’d be a compile error