Programming

Rust 1.100: The Never Type Is Finally Stable, and Cargo Learned to Wait

Rust 1.100 stabilizes the never type after ten years and five failed attempts, along with the core Allocator API and a DropGuard helper. The change most teams will notice is in Cargo: a one-line config that makes it skip any crate version published in the last few days.

Most malicious crate releases don't last long. Somebody's scanner flags them, or a maintainer notices a version they didn't publish, and the release gets yanked within hours or days. The problem is the projects that ran cargo update during those hours.

Rust 1.100.0, released November 12, gives Cargo a way to sit out that window. It also finally stabilizes the never type, which took ten years and five failed attempts, plus the core of the custom allocator API. I installed 1.100.0 with rustup and ran each change against 1.99.0 to see what actually differs.

What's New in Rust 1.100

Change What it does Who notices
Never type (!) Can be named anywhere; Infallible is now an alias for it Code relying on old type inference may stop compiling
Allocator trait Custom allocators for Vec and Box on stable Embedded, game, and database authors
DropGuard Runs a closure when a value goes out of scope, unless dismissed Anyone who wrote a one-off Drop type for cleanup
global-min-publish-age Cargo skips versions newer than a set age Every team with a lockfile
Unused dependency warnings Cargo warns about dependencies nothing uses Everyone, on the next full build
New build-dir layout Build-configuration hash applied to everything Scripts that dig through target/

The Never Type, After Ten Years

The release post puts it plainly: "After 10 years and 5 failed stabilization attempts, the never type is finally stable!" The never type, spelled !, is the type of code that never produces a value, like return, break, or std::process::exit. You could already write -> ! on a function. Now you can name it anywhere, which the post shows with this example:

fn infallible_unwrap<T>(res: Result<T, !>) -> T {
    // ^^ writing `Result<_, !>` was not allowed before
    let Ok(v) = res;
    v
}

std::convert::Infallible is now an alias for !, so every existing API that used Infallible accepts it too. I checked with a function that takes an Infallible and returns !. It compiles on 1.100, because the two are now the same type. On 1.99 the same file fails with "the ! type is experimental."

The part that can break your build

To make Infallible an alias, Rust had to change "never type fallback" from () to ! in the 2015, 2018 and 2021 editions, matching what the 2024 edition already does. That affects code where a generic return type is only ever settled by inference. Here's a minimal case I wrote to see it:

// A generic function whose return type is only fixed by inference.
fn load<T: Default>() -> Result<T, String> {
    Ok(T::default())
}

fn run() -> Result<(), String> {
    load()?; // the result is ignored, so nothing says what T is
    Ok(())
}

fn main() {
    println!("{:?}", run());
}

Compiled with --edition 2021:

Compiler Result
1.99.0 Error from the lint dependency_on_unit_never_type_fallback, which you could allow
1.99.0 with #[allow(...)] Compiles and prints Ok(())
1.100.0 Hard error E0277: the trait bound !: Default is not satisfied
1.100.0 with #[allow(...)] Same error, plus "lint dependency_on_unit_never_type_fallback has been removed: the code warned by this lint no longer compiles"

So if your crate was quietly allowing that lint, 1.100 is where it stops working. The fix is the one the compiler suggests: write the type out, as load::<()>()?. That version compiled and ran on both releases.

LWN's coverage of the stabilization put the scale in numbers: a crater run across public crates found "3,300 crates negatively impacted by the change," but "only seven were fully broken." The rest failed because they depended on older versions of libraries that had already been fixed. If a dependency breaks, update it before you start patching anything yourself.

We recommend reading Rust Is Memory Safe. Somebody Still Does the Knife Work. to continue reading our selection of content. The never type is one more thing the compiler now checks for you, and that piece shows where the standard library steps outside those checks.

Rust Is Memory Safe. Somebody Still Does the Knife Work. Vec::push writes through a raw pointer, get_unchecked skips the check, mem::forget is safe. Read from the Rust standard library. SudoSecurity · Santhdium

Custom Allocators on Stable

The core of allocator_api is stable, so Vec and Box can use an allocator you write. This is my own test: a wrapper around the global allocator that counts live bytes.

// A custom allocator that counts bytes, used with Vec and Box on stable Rust 1.100.
use std::alloc::{AllocError, Allocator, Global, Layout};
use std::cell::Cell;
use std::ptr::NonNull;

#[derive(Default)]
struct Counting {
    live_bytes: Cell<usize>,
}

unsafe impl Allocator for Counting {
    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
        let block = Global.allocate(layout)?;
        self.live_bytes.set(self.live_bytes.get() + layout.size());
        Ok(block)
    }

    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
        self.live_bytes.set(self.live_bytes.get() - layout.size());
        unsafe { Global.deallocate(ptr, layout) }
    }
}

fn main() {
    let counter = Counting::default();
    {
        let mut v: Vec<u64, &Counting> = Vec::with_capacity_in(16, &counter);
        v.extend(0..16);
        let b = Box::new_in([0u8; 100], &counter);
        println!("live bytes with Vec and Box: {}", counter.live_bytes.get());
        drop(b);
        println!("after dropping the Box:      {}", counter.live_bytes.get());
    }
    println!("after the Vec goes too:      {}", counter.live_bytes.get());
}
live bytes with Vec and Box: 228
after dropping the Box:      128
after the Vec goes too:      0

That's 16 u64s (128 bytes) plus a 100-byte box, then back to zero. The same file on 1.99 fails with "use of unstable library feature allocator_api." Only Vec and Box take allocators for now. HashMap, String, and the rest are later work under the Allocators 1.0 project goal.

DropGuard: Cleanup on Every Exit Path

core::mem::DropGuard wraps a value with a closure that runs when the guard is dropped, whether the function returns, hits ?, or panics. DropGuard::dismiss gives the value back without running it. The release post's example uses that for rollback:

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
    });

    for s in strings {
        nums.push(s.parse()?); // ← 2. If `?` returns an error, roll back
    }

    DropGuard::dismiss(nums);  // ← 3. Parsing successful, dismiss the guard
    Ok(())
}

I called it twice on a vector starting as [1, 2]:

Ok(()) -> [1, 2, 3, 4]
Err(ParseIntError { kind: InvalidDigit }) -> [1, 2, 3, 4]

The second call pushed 5 before failing on "six", and the guard truncated it back off. That's the whole pattern, with no custom Drop type.

Cargo Can Now Wait Before Updating

This is the change for anyone worried about supply chain attacks. The release post makes the case in one sentence: "Malicious versions of packages are often caught within hours or days after being published, by either automated scanners or by the community." Cargo now lets you skip that window, a practice usually called a dependency cooldown.

One setting in .cargo/config.toml:

[registry]
global-min-publish-age = "3 days"

I tested it against the live crates.io index on November 16. Two popular crates had fresh releases: rand 0.10.4, published 15 hours earlier, and cc 1.11.2, published 64 hours earlier. A project depending on rand = "0.10" and cc = "1.11" locked the newest versions without the setting. With it:

    Updating crates.io index
     Locking 11 packages to highest Rust 1.100.0 compatible versions as of 3 days ago
      Adding cc v1.11.1 (available: v1.11.2, published 3 days ago)
      Adding rand v0.10.3 (available: v0.10.4, published 15 hours ago)

Both held back, and Cargo says exactly what it skipped. When you need a fresh release now, say for a security fix, there's a one-off override:

CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update rand --precise 0.10.4
    Updating crates.io index
    Updating rand v0.10.3 -> v0.10.4 (published 15 hours ago, minimum age 3 days)

Three limits from the release post are worth knowing:

  • It depends on the registry recording publish times. Versions without a pubtime field in the index are never held back.
  • cargo install ignores the setting entirely, for the crate and its dependencies. Pin versions there with cargo install foo@1.2.3.
  • It's a delay, not a scanner. It only helps if someone else catches the bad release during your waiting period.

A cooldown only controls when a version arrives. For the wider problem of what a dependency can do once it's installed, see why dependency security has to start before CI.

We recommend reading Buying Time: Package Managers Are Adding Delay as a Security Control to continue reading our selection of content. Cargo's new setting is the Rust version of a trend that's spreading across ecosystems, and that piece covers the rest of it.

Buying Time: Package Managers Are Adding Delay as a Security Control Composer 2.11 ships a cooldown policy, vlt holds npm publishes, and Ruby Central's AI scan rejected 90% of findings. Delay is the new control. SudoSecurity · Santhdium

Two Cargo Changes You'll See Without Asking

Unused dependency warnings. On my test project, which listed rand and cc but used neither, cargo check now printed:

warning: unused dependency `cc`
 --> Cargo.toml:8:1
  |
8 | cc = "1.11"
  | ^^^^^^^^^^^
  |
  = note: `cargo::unused_dependencies` is set to `warn` by default
help: consider removing the dependency on `cc`

It only warns when every build target that could use the dependency is built, so cargo check --bin foo won't flag [dependencies], and it never flags dev-dependencies. It's the first lint in Cargo's new [lints.cargo] table.

A new build-dir layout. Cargo now organizes build output by build step and applies the build-configuration hash to everything. That fixes stale and duplicate builds, but the release post warns it "may break build processes and tests that had workarounds." If a CI script reaches into target/debug/deps for a specific file, check it after upgrading.

What This Doesn't Cover

I tested on x86_64 Linux with rustup's minimal profile. I didn't run crater or test real-world crates against the fallback change, so the 3,300 figure is LWN's report of the Rust project's own run. I didn't test the new build-dir layout against an existing CI pipeline, or conjure_zst, the new unsafe function for creating zero-sized types.

The cooldown test used crates.io as it stood on November 16, 2026. Rerun it and the versions held back will be different.

The Actual Point

Rust 1.100 is a big release for language nerds, but the line most teams should copy today is global-min-publish-age in .cargo/config.toml. Pick a few days, keep the override for urgent fixes, and remember that cargo install ignores it.

Before upgrading, build your workspace on 1.99 and look for the dependency_on_unit_never_type_fallback lint in crates on older editions. Anything it flags, including anything you've silenced with allow, is a hard error on 1.100.

The infallible_unwrap and parse_all examples are reproduced from the Rust 1.100.0 release announcement, as is the quote about malicious releases. The fallback test, the counting allocator, and the main that called parse_all are original code using the standard library's documented API. All were compiled and run on November 16, 2026 with rustc 1.100.0 and 1.99.0 from rustup, and the outputs and Cargo messages are reproduced from those runs, including the cooldown test against the live crates.io index. The crater figures are from LWN's report on the stabilization.

$ tail -f /forums

Discussion

Comments live on the community forums — sign in there to reply.