The difference is that attributes like #[cfg]
and proc macro attributes are limited to changing the behavior of the code item or statement which they decorate. become
changes behavior "outside" of the return
, at least using a usual understanding of how setting the result value of the function and exiting the function scope(s) compose together. Dropping any in-scope locals isn't done as part of return
, it's part of the scope exit, which is "outside of" the return
.
You essentially can't[1] even desugar the drop order effects of become
to surface level code at all, because there's no capability to end the storage lifetime of impl Copy
arguments before exiting the function.
You might be able to with an inner function, but I'm not in the right mindspace to figure out if that's ever observably different in subtle ways. Plus optimization will probably suffer from going through the pseudo trampoline. ↩︎