There's currently a somewhat misleading (I claim) error message that states 
"error: use of moved variable".  I claim this should instead be "use of moved 
value". In particular, there's no problem with using the variable; in 
particular, you can mutate it to some new value. For example, this code is 
adapted from the borrowed pointers tutorial:

fn example3() -> int {
    struct R { g: int }
    struct S { mut f: ~R }

    let mut x = ~S {mut f: ~R {g: 3}};
    let qqq = x;
    let y = &x.f;  // Error reported here.
    x = ~S {mut f: ~R {g: 4}}; // ... but this line is fine!
    3
}

FWIW, this error message actually misled me; I'm not just being a PL pedant :).

This change seems significant enough that I should ask, rather than just making 
a change….

John
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to