rust-lang/rust — pull request #18233 by pnkfelix (2014-10-22 15:17:43+00:00)
Title: User-defined placement-box

Add support for user-defined placement-box expressions (i.e. `box () ` for types other than `Box`).

This is a prototype design that @nikomatsakis and @pnkfelix have been working on. It works by desugaring an instance of placement-box into a protocol where we first create the intermediate storage with a pseudo-out-pointer, then initialize the storage, and then convert the out-pointer into the desired box type.

The code was originally written to handle both `box () ` and `box ` via the same uniform desugaring, and it is easy to revise support for the latter; but as is, this PR only puts `box () ` into the desugaring. The reason for this is that the error messages get a lot nastier to handle from the desugared form, and pnkfelix did not want to hold this work up further trying to resolve that.

The final design for this will require an RFC; this code is entirely experimental for now.