In Rust, we can use the Box
type to allocate things on the heap. This type is used to safely abstract pointers to heap memory. Box
Before box
was marked as unstable, it was used as a shorthand for calling Box::new
. However, it's always been intended to be able to allocate arbitrary types, such as Rc
, or to use arbitrary allocators. Neither of these have been finalized, so it wasn't marked as stable for the 1.0 release. This is done to prevent supporting a bad decision for all of Rust 1.x.
For further reference, you can read the RFC that changed the "placement new" syntax and also feature gated it.