Strange E0506 Error?

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?

Ok, this looks like a bug that was fixed between 1.35.0 and 1.36.0

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.