Skip to content

2025/02/19/you-can-t-eliminate-useless-stack-allocations-in-rust #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
utterances-bot opened this issue Feb 19, 2025 · 1 comment
Open
Labels
utterances Comment thread created by https://utteranc.es/

Comments

@utterances-bot
Copy link

You can’t eliminate useless stack allocations in Rust | Mantle’s Potato Bakery

The shiny “language of the year” lacks such an important and widely-used feature.

https://csmantle.top/2025/02/19/you-can-t-eliminate-useless-stack-allocations-in-rust.html

Copy link

I think I should add up some comments since I also have read some issues and have some thoughts.

So as we all know, there was a box keyword help us to directly place things on heap.( Thanks to RFC 809 ) But it has been removed by rust-lang/rust#483333, and it explain why the removed this in https://github.com/rust-lang/rust/pull/48333#issuecomment-376876344.

The explain said one thing important that construction in Rust is totally different with C++. Even the author think you can make placement as what Box::new did, there are still unaddressed considerations.

It's upset because It looks like the best way to do that currently is use MaybeUnInit struct and it will make unsafe. As what I've seen in a group, "Only to wait when some big companies have this issue and they want to solve it over money" we can use placement without unsafe.

@CSharperMantle CSharperMantle added the utterances Comment thread created by https://utteranc.es/ label May 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
utterances Comment thread created by https://utteranc.es/
Projects
None yet
Development

No branches or pull requests

3 participants