Should std have an Arena type?

A reason to have a non-allocator version of such a type in the stdlib would be that something like typed_arena (which I maintain, although very passively) cannot be an implementation which is both optimally efficient an optimally general without #[may_dangle]. typed_arena opts for the optimally general version (which is useful even for graph construction), by building it on top of Vec<T> (and leveraging Vec<T>'s #[may_dangle]), but this has performance limitations. Given that #[may_dangle] very well may never be stabilized, this is unfortunate.

That said, it's possible allocators solve this sufficiently. I haven't thought about it very deeply, to be honest.

1 Like

It (or it's successor) should be, IMNSHO. std collections shouldn't be observably magic in ways that are never intended for the wider ecosystem.

5 Likes