Rust 1.100 (2026-11-12) finally stabilized the core of allocator_api. After roughly ten years in limbo, what landed is not the whole feature. It is a deliberate MVP: the Allocator trait, plus support in Vec and Box. Using the stabilization report and real examples, this article covers what you can use now, what you still can't, and why it ended up this shape.

Why this, why now

The problem

Until now, stable Rust really had one way to change allocators: #[global_allocator] with GlobalAlloc, which swaps the allocator for the whole process (jemalloc, mimalloc, and so on). But what you usually want is a different strategy for just one part of the program:

Until now, the answer was a dedicated collection type for each need: bumpalo's own collections, smallvec, aligned-vec, the allocator-api2 polyfill. The result was fragmentation. Something that is "just a Vec" got a different type and API purely because it allocates differently. cetra3 puts the question this way: if you want both block-aligned vecs and stack-allocated vecs, do you really pull in smallvec and aligned-vec? The goal of stabilization is to swap the allocation strategy through a type parameter while keeping the std collections.

How it works

1. The stabilized trait

pub unsafe trait Allocator {
    // required
    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;
    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);
    // provided
    fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;
    unsafe fn grow(&self, ptr: NonNull<u8>, old: Layout, new: Layout) -> Result<NonNull<[u8]>, AllocError>;
    unsafe fn grow_zeroed(&self, ptr: NonNull<u8>, old: Layout, new: Layout) -> Result<NonNull<[u8]>, AllocError>;
    unsafe fn shrink(&self, ptr: NonNull<u8>, old: Layout, new: Layout) -> Result<NonNull<[u8]>, AllocError>;
}

The design decisions worth knowing: