Could someone explain why the following snippet does not work? It is not intuitive for me.
struct X;
struct Y {
x: X
}
impl Y {
pub fn foo(&mut self) {
self.x = self.x;
}
}
The error is “cannot move out of borrowed content” on self.x = self.x
. I’d understand if I was assigning it to something else.
I am aware that the function is not meaningful, but it is a minimized example that I do not understand.
Thanks.