Rust 1.100 stabilizes the never type after 10 years

The Rust team has released Rust 1.100.0. Existing rustup users can get it with rustup update stable. The headline item is the never type: after 10 years and 5 failed stabilization attempts, it is stable, and the release notes say this completes the project goal for the work.

The never type, written ! in code, is the canonical uninhabited type. It is the type of diverging computations, ones that never resolve to a value and after which code is unreachable. Expressions such as return, break and std::process::exit have type !. Because no value of ! can exist, Rust allows a never-to-any coercion, which turns ! into any other type; that is what sets it apart from other uninhabited types. It lets a match branch such as None => return sit next to branches that produce a u32. The type could already be used and observed this way, and named in function return types (-> !). What is new is that it can be named anywhere, for example Result<T, !>.

The release also makes Infallible an alias to the never type, so all old APIs that used Infallible work with !. That was the plan since Infallible was introduced and one reason stabilization was so hard; the post points to a talk by waffle on the troubles involved. Doing it required a breaking change: the never type fallback changes from () to ! in editions before 2024 (2015, 2018 and 2021), as edition 2024 already had. The Rust team says this should largely be unnoticeable but can affect code in some rare cases, for example when ignoring the result of a function that returns a generic parameter, and the compiler might detect more code as unreachable. To limit the impact, the team issued future compatibility warnings far in advance and released fixes to public crates that broke. If a dependency fails because of the never type, the advice is to update it.

The core of allocator_api is stable too. Library authors can now define custom allocators through the newly stabilized Allocator trait and use them with Vec and Box. This is the foundation of the Allocators 1.0 project goal. A lot remains, including a wider API surface for custom allocators and support on more collections and pointer types; the team expects more to be stabilized soon.

Two smaller std additions arrive. core::mem::DropGuard is a helper type that runs a closure when dropped. It takes a variable and a closure, implements Deref and DerefMut so the variable stays usable, and runs the closure and consumes the variable on drop. Its dismiss method returns the variable without running the closure, which suits all-or-nothing, transaction-like APIs with rollback. The example parse_all pushes parsed integers into a Vec, and a guard truncates the vector back to its original length if any parse fails with ?; on success the guard is dismissed. std::mem::conjure_zst is the dedicated way to create a value of a zero-sized type when you know that is safe, replacing transmuting () or MaybeUninit::uninit().assume_init(). It is unsafe because APIs often rely on being unable to construct such types. The post's example is PyO3's Python<'py>, a zero-sized token representing holding the Python GIL; conjuring one would let safe PyO3 calls violate that precondition.

Cargo gets three changes. First, it now reports unused dependencies through the lint cargo::unused_dependencies, set to warn by default, as part of a new Cargo linting system controlled by the [lints.cargo] table in Cargo.toml. Rustc's unused_crate_dependencies lint gave false positives under Cargo because dependencies can be shared among build targets. The Cargo warning only appears when every build target that may use an entry in a dependencies table is built, so cargo check --bin foo will not show warnings for unused [dependencies]. Unused dev-dependencies never produce a warning, since there is no way to ensure every development target is built.

Second, the build-dir layout changes to reduce cache collisions. Cargo builds libraries and binaries in the build-dir and then uplifts final artifacts to the target-dir. Copies for different build configurations, such as different --features, are kept unique by a build-configuration hash, but that hash was not always applied because of platform constraints, which could cause extra rebuilds, missed rebuilds and confusion about which binaries are used, worse when a build-dir is shared across git worktrees. Now the hash is applied to all content: directories are organized by build step rather than file type, and the hash moves from the file name to the parent directory. The work began with the build directory layout project goal in 2025 and is a step toward cache garbage collection, cross-workspace cache de-duplication, cross-workspace caching and fine grain locking. It is an internal change, but it may break build processes and tests that had workarounds for missing or incomplete features; cargo#17287 lists possible solutions.

Third, Cargo's min-publish-age aware dependency resolution, also called dependency cooldowns, is stable. The post notes that malicious package versions are often caught within hours or days of publication. You opt in through .cargo/config.toml, for example global-min-publish-age = "3 days" under [registry]. Cargo then skips any version published more recently and reports what it held back, such as cc v1.11.0 with v1.18.0 available, published 3 hours ago. For one update you can override the check with CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow, as in cargo update clap --precise 4.6.9; the newer version stays in Cargo.lock until a later cargo update re-resolves it. Versions without a pubtime field in the registry index are never held back, and cargo install ignores the minimum age for both the installed crate and its dependencies, so pin a version with cargo install foo@1.2.3 if needed.

The stabilized APIs include std::alloc::Allocator, Global and System, Allocator implementations for Global, System, &A, &mut A, Box<T, A>, Arc<T, A> and Rc<T, A>, Box::new_in, and PartialEq impls between Cow<'_, [U]> and Vec<T, A>, &[T] and &mut [T].

Key facts

  • Rust 1.100.0 stabilizes the never type (!) after 10 years and 5 failed stabilization attempts, and it can now be named anywhere, such as Result<T, !>.
  • Infallible becomes an alias to !, which forces a breaking change: the never type fallback moves from () to ! in editions 2015, 2018 and 2021; the team calls it largely unnoticeable but possible to affect code in rare cases.
  • The core of allocator_api is stable: the Allocator trait lets custom allocators work with Vec and Box, the first step of the Allocators 1.0 project goal.
  • New std helpers: core::mem::DropGuard runs a closure on drop (with dismiss for rollback patterns), and the unsafe std::mem::conjure_zst creates zero-sized values.
  • Cargo adds unused-dependency warnings, a reworked build-dir layout that applies the configuration hash everywhere, and opt-in min-publish-age dependency cooldowns, for example global-min-publish-age = "3 days".

Why it matters

The never type has been a long-running gap in the language: the post counts 10 years and 5 failed stabilization attempts. Making ! nameable anywhere, and turning Infallible into an alias for it, finishes a plan that dates from Infallible's introduction. The allocator work is the first concrete step of the Allocators 1.0 project goal, and the Cargo changes address slow builds, cache collisions and supply chain exposure.

Who it affects

Every Rust user who updates gets the release, but the groups with most at stake differ. Library authors writing generic error handling, or using Infallible, benefit from the never type changes. Those building custom allocators can now use them with Vec and Box. Teams on editions 2015, 2018 or 2021 see the fallback change from () to !. Anyone with build scripts or tests that depend on the old build-dir layout may need to adjust. Projects wary of malicious package releases can use dependency cooldowns.

How to use it

Update with rustup update stable. To try dependency cooldowns, add a [registry] section with global-min-publish-age = "3 days" to .cargo/config.toml (3 days is the post's example, not a stated default). To pull a fresh version anyway, run CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update clap --precise 4.6.9. To use the new unused-dependency lint, build every target; the lint is controlled by the [lints.cargo] table. For rollback-style code, wrap a value in DropGuard::new(value, closure) and call DropGuard::dismiss on success. If a dependency breaks because of the never type, try updating it first.

How solid is it

This is the official stable release announcement from the Rust team, and the code examples and command output are shown in the post. It gives no performance figures for any feature. Several items are explicitly partial: the Allocator API covers only the core parts, with Vec and Box as the supported types, and the post says a lot remains to be done. The unused-dependency warning only fires when every relevant build target is built, and never for dev-dependencies.

Risks and caveats

The never type fallback change is a real breaking change for editions before 2024, though the Rust team says it should largely be unnoticeable and that the compiler might flag more code as unreachable. The build-dir change is internal but may break build processes and tests with workarounds; see cargo#17287. Cooldowns depend on the registry recording publish times, since versions without a pubtime field are never held back, and cargo install ignores them. The post stresses that cooldowns reduce the risk from some supply chain attacks but are not a complete defense, so dependency updates should still be reviewed. conjure_zst is unsafe because misuse can break safety guarantees such as PyO3's GIL token.

“Cooldowns reduce the risk from some supply chain attacks but are not a complete defense on their own.”

— Rust team, Rust 1.100.0 release announcement