Rust’s allocator API moves memory policy into the container
Rust 1.100 stabilizes the core allocator API for Vec and Box. That makes allocation policy explicit at a collection boundary, while ownership, allocator equivalence and invalidation rules still determine whether the design is sound.
A collection can own more than its elements
A vector’s type usually tells us what its elements are, but not where its backing storage comes from. Rust 1.100, released on 12 November 2026, stabilizes the core of allocator_api: library authors can pair custom allocators with selected standard-library types, currently including Vec and Box. The release is a real change in what stable code can express, though it is not the end of the allocator project. The Rust team explicitly says broader collection and pointer support remains future work. [1] [2]
This is useful when memory policy belongs to a component: an arena per request, a bounded region for a parser, or a pool owned by a subsystem. With a global allocator, that policy is process-wide. With an allocator-aware collection, the policy can be carried by the value whose storage it governs. This moves a design choice into a type and its ownership graph; it does not make allocation free or automatically make a custom allocator safe.
The allocator travels with the storage
A minimal example can use the standard system allocator without implementing one. On Rust 1.100 or later, Vec::new_in(System) constructs a vector that owns a System allocator value, and push exercises the collection normally. The second type parameter is part of the vector’s type-level contract. Code accepting Vec<T, A> can state that it works with an allocator A, rather than quietly assuming the process default. [4]
That distinction matters at handoff points. If a vector is returned from a function, stored in a struct, or converted into a box, the storage’s allocator has to remain available for later growth and eventual deallocation. A raw pointer plus a length is not a complete ownership transfer: the matching allocator and the exact layout rules also matter. Rust’s stabilized APIs include allocator-aware construction and raw-parts operations, which make the pairing explicit rather than erasing it.
use std::alloc::System;
fn main() {
let mut values = Vec::new_in(System);
values.push("request-local data");
assert_eq!(values[0], "request-local data");
}Equivalence is an ownership promise
The Allocator contract is more demanding than “allocate these bytes.” It defines which allocator values may be treated as equivalent, which blocks remain allocated, and what a successful grow or shrink does to the old pointer. For a successful grow, for example, the old block is invalidated even if the allocator extends it in place; clients must use the returned pointer. If growth fails, the old block remains valid and its contents are unchanged. [3]
These rules explain why an allocator cannot be swapped casually after a collection has allocated memory. A collection may rely on its allocator to release or resize that memory later. Replacing it with a non-equivalent allocator could make the eventual deallocation use the wrong policy. The trait is unsafe to implement because these lifetime, validity, layout, and non-unwinding guarantees are part of memory safety. A safe wrapper cannot compensate for an implementation that violates them.
Use the narrowest policy boundary
For most applications, the default global allocator remains the simplest choice. An allocator parameter is worthwhile when the boundary has a concrete reason: deterministic arena lifetime, memory accounting scoped to a subsystem, or a library API that must let callers choose storage policy. Before introducing it, draw the ownership path from allocation to final drop. Ask whether the allocator is stable for that interval, whether every transfer preserves the allocator, and what happens when capacity growth fails.
A request-scoped arena illustrates both the benefit and the limitation. It can make bulk release natural when the request ends, but every collection backed by it must stop being used before the arena is destroyed. The allocator API expresses the association; it does not by itself prove that the arena outlives all borrows or that the arena’s internal synchronization is correct. Prefer an allocator value whose lifetime and mutation rules are visible in the surrounding types, then test failure paths and cross-component transfers.
Rust 1.100 therefore changes the architecture available to stable libraries more than it changes the default behavior of everyday vectors. It gives selected containers an explicit storage-policy parameter and stabilizes the contract that makes that parameter meaningful. The practical opportunity is local control over memory ownership. The practical cost is that allocator identity, lifetime, equivalence, and failure behavior become part of the API review.