Dev News Daily ENDE

Rust 1.100 stabilises the never type after five failed attempts and adds the Allocator trait

The Rust team released Rust 1.100.0 on 12 November. The headline item is the never type, written as an exclamation mark, which the announcement says is stable after ten years and five failed stabilisation attempts.

The never type describes computations that do not produce a value: return, break and process::exit all have it, and Rust already let it coerce to any other type, which is why a match arm can simply return. What changes now is that it can be named anywhere, for example as Result with never as the error type, so a function can take a result that cannot fail and destructure it with a plain let. Infallible becomes an alias for never, which makes older APIs built on Infallible compatible with the new spelling.

That alias required a breaking change. Editions 2015, 2018 and 2021 now use never rather than unit as the fallback type, matching what edition 2024 already did. The team says the effect should rarely be visible, but it can show up when code ignores the result of a function that returns a generic parameter, and the compiler may now flag more code as unreachable. Future-compatibility warnings ran well ahead of the release and fixes were sent to public crates; if a dependency breaks, updating it is the first step.

The second large piece is the core of the allocator API. The newly stable Allocator trait lets library authors write custom allocators that work with Vec and Box. The team describes this as the base of its Allocators 1.0 goal, with more collections and pointer types still to come.

Two smaller library additions round it out. core::mem::DropGuard wraps a value with a closure that runs when the guard is dropped, on every exit path, and a dismiss method hands the value back without running it; the announcement uses it to roll back a vector when parsing fails partway. std::mem::conjure_zst is an unsafe function that gives a sanctioned way to create a value of a zero-sized type instead of transmute tricks.

Cargo changes too. A new lint system under the lints.cargo table now warns about unused dependencies, with the caveat that the warning only appears when every target that could use the dependency is built. The build directory is reorganised around build steps, with the configuration hash moved into the parent directory, to end collisions between builds with different features or across git worktrees.

Rust 1.100 stabilises the never type after five failed attempts and adds the Allocator trait
Rust 1.100 stabilises the never type after five failed attempts and adds the Allocator trait — Dev News Daily

Why it matters

The never type has been the standing example of a feature that is easy to describe and hard to land. Its arrival, with a fallback change across old editions, is the part to test on large codebases. The Allocator trait matters more to embedded and systems projects that have relied on nightly for custom allocation.

Written by Victoria Shinder.