Hacker News new | ask | show | jobs
by MetaDark 2214 days ago
> That's exactly what happens: a Rust "move" is under the covers a memcpy().

Not exactly. The Rust compiler is usually pretty smart about optimizing out memcpy for most moves.

For example when returning a large struct from a function, the optimizer could add an "out" reference parameter to the function and the function would directly initialize the return value into that reference.