A basic version of Named Return Value Optimization (NRVO) landed in rustc last week! https://github.com/rust-lang/rust/pull/72205 … This is exciting for Rust because it's an optimization that's common in C++ that Rustc didn't know how to do yet. But now it does in some cases!
I'm don't know for sure, but I don't believe so? This mostly has to do with reasoning about how values are used on the stack, and whether intermediate copies can be removed. Though I don't know the exact mechanics behind it.