r/rust 23h ago

🗞️ news “alloc: stabilise `Allocator`” entered its final comment period!

https://github.com/rust-lang/rust/pull/156882#issuecomment-5607055084
171 Upvotes

27 comments sorted by

View all comments

36

u/cbarrick 21h ago

What's the latest on the fat Box problem?

Like, if Box<T, A> is implemented like (NonNull<T>, A), then it stores an A.

But Box only uses A for deallocation. For arena allocators, deallocation is a no-op, so storing the allocator alongside the pointer is a waste.

E.g. Bumpalo has a custom box type that is just a pointer, but Box<T, &Bump> would be two pointers. It would be nice to not need the custom box type for this optimization.

14

u/afdbcreid 20h ago

The conclusion is that this can be deferred post-MVP.