What's new in Rust 1.100

In this article
Rust 1.100.0 is out with several notable changes: the never type (the ! type, representing computations that never return a value) has finally been stabilized after 10 years and 5 failed attempts, the core of allocator_api has been stabilized, and the standard library gains DropGuard and conjure_zst. Cargo also receives important improvements such as warnings for unused dependencies, a new build-dir layout and a min-publish-age mechanism that helps limit the risk from malicious package versions.
The never type and compatibility changes
The never type, written as ! in code, is the canonical uninhabited type (a type that can have no values). It is the type of diverging computations, that is, computations that never produce a value and after which no code can ever be reached. Expressions that end control flow, such as return, break and std::process::exit, also have type !.
Because no value of this type can exist, Rust allows never-to-any coercion: turning ! into any other type. This is what sets it apart from other uninhabited types. As a result, a branch of a match or if can return no value, as in the following example:
fn mrrrow ( option : Option < u32 > ) {
let value = match option {
// `x` has type `u32`
Some ( x ) => x ,
// `return` has type `!`, which is then coerced to `u32`,
// allowing the `match` to pass type checking.
None => return ,
} ;
// ...
}fn infallible_unwrap < T > ( res : Result < T , ! > ) -> T {
// ^^ writing `Result<_, !>` was not allowed before
let Ok ( v ) = res ;
v
}To change Infallible, the development team had to introduce a breaking change: never type fallback switches from () to ! in editions before 2024 (that is, 2015, 2018 and 2021), just as edition 2024 already did. The change goes largely unnoticed but can affect code in a few rare cases, for example when ignoring the result of a function that returns a generic parameter. The compiler may also detect more unreachable code. If a dependency breaks because of the never type, update it, since a fix may already have been released.
Allocator API, DropGuard and conjure_zst
The core of allocator_api has been stabilized, allowing library authors to define custom allocators that work with certain standard library types, currently Vec and Box, through the newly stabilized Allocator trait. This is the foundation of the Allocators 1.0 project goal. Much work remains, including expanding the API surface usable with custom allocators and stabilizing support on more collections and pointer types.
The Drop trait lets code run when a variable goes out of scope, whether it exits via return, ? or panic. Even so, when you only need to run a piece of code unconditionally when a function ends, implementing Drop can be inconvenient. core::mem::DropGuard is a new helper type that runs a closure when dropped. It takes a variable and a closure, implements Deref and DerefMut so the variable can still be used as usual; when dropped, it runs the closure and consumes the variable.
use std :: mem :: DropGuard ;
use std :: num :: ParseIntError ;/// Attempt to parse all `strings` and push them into `nums`.
/// If parsing any of them fails, `nums` remains unchanged.
fn parse_all ( nums : & mut Vec < u32 > , strings : & [ & str ] ) -> Result < ( ) , ParseIntError > {
let len = nums . len ( ) ;
let mut nums = DropGuard :: new ( nums , move | nums | {
nums . truncate ( len ) ; // ← 1. Reset the vec on failure
} ) ;Cargo reports unused dependencies
Building dependencies that are no longer used, or that are only needed on certain platforms, can slow down builds. Rustc has the unused_crate_dependencies lint for this purpose, but it produces false positives when used with Cargo, because a dependency may be shared across multiple build targets. Cargo now reports unused dependencies on its own:
warning: unused dependency `tracing-subscriber`
--> Cargo.toml:23:1
|
23 | tracing-subscriber.workspace = true
| ^^^^^^^^^^^^^^^^^^
|
= note: `cargo::unused_dependencies` is set to `warn` by default
help: consider removing the dependency on `tracing-subscriber`Fewer cache conflicts in Cargo
Cargo builds every library and binary in the build-dir, then promotes the final artifacts to the target-dir. Different build configurations, such as --features, can produce several different copies in the build-dir. The copies are distinguished by a build-configuration hash, but this hash is not always applied due to platform constraints, leading to redundant rebuilds, missed rebuilds or confusion about which binary and library are in use. The problem is worse when sharing a build-dir across git worktrees.
The build-dir now applies the hash consistently to all contents, by organizing directories by build step rather than by file type, and moving the hash from the file name to the parent directory. This work began with the 2025 project goal on the build directory layout, and is a milestone toward a new project goal, paving the way for cache garbage collection, cross-workspace cache de-duplication, cross-workspace caching and fine grain locking.
Although it is an internal change, it may break build and test workflows that had workarounds for missing or incomplete features; in some cases the workarounds are no longer needed. Cargo issue 17287 describes possible solutions and where to add new use cases.
Cargo min-publish-age and dependency cooldowns
Malicious package versions are often detected hours or days after publication, by automated scanning tools or the community. Rust 1.100 stabilizes Cargo's dependency resolution by min-publish-age, which makes it possible to wait out that period before picking up a newly published version. This practice is also called dependency cooldowns. Enable it with .cargo/config.toml:
[ registry ]
global-min-publish-age = " 3 days "When selecting versions, Cargo ignores any version newer than that threshold and reports what it held back:
$ cargo update
Updating crates.io index
Locking 2 packages to highest compatible version as of min-publish-age
Adding cc v1.11.0 (available: v1.18.0, published 3 hours ago)
Adding clap 4.6.7 (available: 4.6.9, published 2 days ago)When you need a new version right away, you can skip the check for a single update:
$ CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE = a l l o w cargo update clap - -precise 4.6.9
Updating crates.io index
Updating clap 4.6.7 -> clap 4.6.9 (published 2 days ago, minimum age 3 days)The newer version is written to Cargo.lock and stays there until a later cargo update resolves again. Keep the following points in mind:
The mechanism depends on the registry recording the publication time of each version; a version without a pubtime field in the index is never held back.
cargo install ignores the minimum publish age, both for the crate being installed and for its dependencies; if needed, pin the version with cargo install foo@1.2.3.
Cooldowns reduce the risk from some supply chain attacks but are not a complete defense; you should still review dependency updates as usual.


