3 ms·
> Would be great instead to see more examples of how e.g. destructive move in That allows generating better assembly. One example isn't about the destructive a
by steveklabnik 10y ago
> Would be great instead to see more examples of how e.g. destructive move in That allows generating better assembly.
One example isn't about the destructive aspect: a move in Rust is always a memcpy. Since there's no move constructors, there's no way to run arbitrary code, so it's always a memcpy. The optimizer can also then elide this copy if it isn't actually needed.
- quicknir 10y agoYes that's what I was referring to, the terminology I used has been used before in C++. Rust s moves are considered destructive in the sense that the old object is no longer functional, which of course is fine because it can't be used.
- steveklabnik 10y agoOh yeah sorry, I see what you're saying now.