Currently in Rust master (0.10-pre), when you move one element of a unique vector and try to move a different element, the compiler complains:
let x = ~[~1, ~2, ~3];
let z0 = x[0];
let z1 = x[1]; // error: use of partially moved value: `x`
This error message is somewhat different from if you were to move the entire vector:
let y = ~[~1, ~2, ~3];
let y1 = y;
let y2 = y; // error: use of moved value `y`
Why the different message? If x
is only "partially moved" in the first example, is there any way to "partially move" different parts of x
? If not, why not just say that x
is moved?