Hey,
So, the following program givesn an E0506
error complaining that y
is borrowed on the right-hand side of the last statement and, hence, cannot be assigned:
fn main() { let mut x = 0; { let mut y = &mut x; y = y; } }
This seems confusing to me as the last statement is essentially a nop. In fact, I can rewrite it as follows and its fine:
fn main() { let mut x = 0; { let mut y = &mut x; let mut z = y; y = z; } }
Thoughts?