On 11/18/2011 07:55 AM, Marijn Haverbeke wrote:
- 'Last uses' of locals (arguments passed in a mode that makes them
owned by the function, and local let variables) are now treated
specially -- when stored or passed somewhere, they are moved instead
of copied. Most importantly, this makes most returning a local or
putting it in a data structure more efficient. This is taken into
account by the copyability analysis, so that you only get an error
when your program actually tries to use a noncopyable local after
storing it somewhere.

I'm worried that this rule is too clever. If I have some code like:

let a = "whatever";
let v = variant(a);

then 'a' is moved into 'v'. If I change the code later to use 'a' again after the initialization of 'v' then variant(a) becomes a copy. I don't know that there's actually any risk there, but it seems counterintuitive.

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to