fn main() {
let mut x = 42;
let y = &x;
*y = 5;
}
This does not compile. Why does it have to be a &mut to x?
In my understanding, the reference (i.e. address where the value of x is stored) does not change, only the value stored on that address. And x is mut.
Does compile:
fn main() {
let mut x = 42;
let y = &mut x;
*y = 5;
}