Rust 1.100 Stabilizes Never Type After a Decade of Development

Rust 1.100 finally stabilizes the never type, introduces new memory allocation APIs, and strengthens Cargo's dependency management.

The Rust team has announced Rust 1.100, marking the programming language’s 100th stable version. The biggest change is the stabilization of the never type (!), which took ten years and five unsuccessful attempts to reach stable Rust. It represents computations that never produce a value, such as functions that always terminate execution or panic.

Although Rust already supported the never type in function return signatures, version 1.100 allows developers to use it in any type position, including generic types such as Result<T, !>. The existing Infallible type also becomes an alias for !, making APIs that use either type compatible.

However, there is a small compatibility concern. Rust 1.100 changes the never-type fallback from () to ! for the 2015, 2018, and 2021 editions, matching the behavior introduced in Rust 2024. The change should affect few projects, but some existing code or dependencies may require updates.

Another development is the stabilization of the core Allocator API. Developers can now define custom memory allocators and use them with standard library types such as Vec and Box. This gives greater control over memory allocation, especially for applications with specialized memory requirements. Support for additional collections and pointer types is planned for future releases.

Rust 1.100 also introduces DropGuard, a new standard library helper that executes a closure when a value goes out of scope, including when a function returns early or panics. It includes a dismiss method that prevents the cleanup action from running, making it useful for operations that need to roll back changes when something fails.

On the tooling side, Cargo gains a new dependency cooldown mechanism to reduce exposure to software supply-chain attacks. The feature lets developers specify a minimum age for newly published packages before Cargo considers them during dependency resolution.

The feature is optional and does not apply to cargo install. It also depends on package registries providing publication timestamps and should be treated as an additional safeguard rather than a complete security solution.

Moreover, Cargo now reports unused dependencies declared in Cargo.toml, helping developers identify packages that increase build times unnecessarily. The warning is enabled by default, although its detection depends on which build targets are checked, and unused development dependencies are currently excluded.

Build caching also receives improvements. Cargo now consistently separates build artifacts using configuration hashes in its build directory layout. This fixes collisions between builds with different configurations that could previously cause unnecessary recompilation, missed rebuilds, or confusion over which artifacts were used.

Finally, the release stabilizes std::mem::conjure_zst, an unsafe function for constructing zero-sized types when developers can guarantee it is valid. Several smaller APIs are also stabilized, including bool::toggle, Vec::from_fn, and new prefix and suffix trimming methods for strings and other types.

Additional information is available in the official release notes. Existing installations managed through Rustup can be updated by running rustup update stable.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a Reply

Your email address will not be published. Required fields are marked *