You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class example {
let mut x: int;
new() {
self.x = 1;
}
drop {}
}
fn main(_args: [str]) {
let x: example = example();
let _z = fn@() {
let _a: int = x.x;
};
x.x = 5;
}
noncopyable-field.rs:13:18: 13:19 error: copying a noncopyable value
noncopyable-field.rs:13 let _a: int = x.x;
^
Notably, it seems to be trying to copy the example object, not the int (as I first assumed), at least if you trust the error location marker.
So the question is, why does accessing a field of the object try to copy it?
This particular repro goes away if you remove the write to x.x after the closure is created, but I have another, larger one where the write isn't there and it still does it.