[rust-dev] box syntax question

Patrick Walton pcwalton at mozilla.com
Wed Jul 2 23:09:12 PDT 2014


On 7/2/14 11:08 PM, Igor Bukanov wrote:
> So at some future point it would be possible to replace
> TypedArena_instance().alloc(X) with box(TypedArena_instance) X
> avoiding an extra move of X from a temporary allocated on the stack
> that the compiler in general cannot optimize?

Yes. Under the hood, this will be implemented via return value 
optimization and an unboxed closure.

Patrick



More information about the Rust-dev mailing list