<story><title>Is Rust stack-efficient yet?</title><url>https://arewestackefficientyet.com/</url></story><parent_chain></parent_chain><comment><author>klodolph</author><text>This affects the way you write code, too.&lt;p&gt;I was writing something in Rust and I wanted to create a new boxed object.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  Box::new(...)
&lt;/code&gt;&lt;/pre&gt;
Boom! Program crashes. The object I’m putting in the heap is too large for the stack. Rustc does this by instantiating the object on the stack, and then copying it to the box. I don’t really want to fuss with nightly or stuff like Box::new_uninit just to deal with this. C++ has both regular `new` and placement `new`, both of which put objects in memory which is already allocated. I had assumed that the Rust compiler could optimize out a move, since that’s such a prominent feature in C++ compilers.</text></comment>
<story><title>Is Rust stack-efficient yet?</title><url>https://arewestackefficientyet.com/</url></story><parent_chain></parent_chain><comment><author>kibwen</author><text>Prior discussion with the author on Reddit: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.reddit.com&amp;#x2F;r&amp;#x2F;rust&amp;#x2F;comments&amp;#x2F;yw57mj&amp;#x2F;are_we_stack_efficient_yet&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.reddit.com&amp;#x2F;r&amp;#x2F;rust&amp;#x2F;comments&amp;#x2F;yw57mj&amp;#x2F;are_we_stack_e...&lt;/a&gt;</text></comment>