Re:Common Rust Lifetime Misconceptions
by MetaDark on Saturday May 23, 2020 @02:16PM
(#23285080)
> 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.
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.