skip to content

Rust promises stable code keeps compiling, yet a toolchain upgrade turns a Rust CI pipeline red; what does the stability promise leave out, and how do you contain it?

level: seniorimportance: should knowfreq 25%

answer

  1. read the Compatibility Notes
  2. soundness beats compatibility
  3. new impls, new ambiguity
  4. deny(warnings) meets a new lint
  5. pin, then test on beta

basics

~20 s

The promise keeps stable features working, but releases may still fix soundness holes and compiler bugs, add std impls that break type inference, change unguaranteed behaviour, and add lints that deny(warnings) turns into errors. Pin the toolchain and test on beta.

solid answer

~40 s

Rust commits to supporting every stable feature in all future releases, yet each release's notes carry **Compatibility Notes** for breakage it accepts: soundness fixes (Rust 1.66 stopped opaque types implying lifetime bounds), compiler bugs that had accepted code by mistake, std additions that leave inference ambiguous (1.80's `FromIterator` impls for `Box<str>`), and behaviour that was never guaranteed (1.99's exhausted `RangeInclusive`). New lints are allowed in any release, so a crate with `#![deny(warnings)]` or `-D warnings` fails on them, while registry dependencies are compiled with lints capped. Contain it by pinning the toolchain and upgrading by pull request, running a CI job on beta, and fixing future-incompatibility warnings before they become errors.

go deeper

for a junior

Know that stable Rust releases are designed not to break working code and that each release has notes listing compatibility changes.

for a middle

Name the kinds of accepted breakage: soundness fixes, bug fixes, inference changes, unguaranteed behaviour and new lints.

for a senior

Diagnose a red pipeline after an upgrade: check deny(warnings) against new lints, read the Compatibility Notes, and run cargo report future-incompatibilities.

for a principal

Decide how the organisation absorbs releases: pinned toolchains, a beta canary job, a regular bump cadence, and who triages breakage.

## What the promise actually says When Rust 1.0 shipped in 2015 it set **"stability without stagnation"** as its rule: once a feature is released on stable, it is supported in every future release. The Rust Book puts it from the user's side: you should never have to fear upgrading to a new stable release. Editions exist precisely so that changes which would break code, such as a new keyword, can be made opt-in per crate instead. The promise is real, and for most code an upgrade is silent. But it is a promise about **features**, not about every program that a buggy compiler once accepted. Each release's notes in `RELEASES.md` end with a **Compatibility Notes** section listing the breakage the project judged acceptable. A senior engineer reads that section before upgrading a pinned toolchain. ## What the promise leaves out | Category | What it looks like | A release that did it | |---|---|---| | **Soundness fixes** | code that compiled only because of a hole in the type system | 1.66: opaque types no longer imply lifetime bounds, "a soundness fix which may break code that was erroneously relying on this behavior" | | **Compiler bugs accepted by mistake** | an attribute or construct that stable should never have allowed | 1.99: `#[repr(simd)]` had been accidentally allowed on macro invocations on stable | | **Inference changes** | a new std impl leaves an inferred type ambiguous | 1.80: new `FromIterator` impls for `Box<str>` made type inference fail in some cases | | **Unguaranteed behaviour** | code depended on something the docs never promised | 1.99: an exhausted `RangeInclusive` may now report different `start()` and `end()` values | | **New lints** | a fresh warning, or a lint promoted to deny-by-default | 1.91: `semicolon_in_expressions_from_macros` became deny-by-default on its way to a hard error | Nightly features have no promise at all: anything behind `#![feature]` can change or vanish between nightlies. ## Why warnings are the usual culprit The most common red pipeline after an upgrade is not a compatibility note but a **lint**. Two settings interact: - In your own crate, `#![deny(warnings)]` or `RUSTFLAGS="-D warnings"` turns every warning into an error, including warnings the new compiler has only just learned to emit. Cargo's own CI guide notes that CI "can fail due to new toolchain versions because there are limited compatibility guarantees around warnings". - For **registry dependencies**, such as crates from crates.io, Cargo passes `--cap-lints allow`, so their warnings neither appear nor fail your build. Path dependencies, such as other members of your workspace, get no cap and are linted like your own crate. Force-warn lints are not capped either, and some future-incompatibility warnings are deliberately reported for dependencies so that their authors hear about them. Denying warnings is still a reasonable gate, as long as the toolchain it runs on is pinned and moved forward deliberately. ## Seeing breakage coming Hard breaks are usually announced: 1. A change that will break code is first a **future-incompatibility warning** (a lint that fires, often even in dependencies). 2. `cargo report future-incompatibilities` lists the crates in your build that triggered such warnings, the ones that will stop compiling in a future rustc. 3. Later releases raise the lint to deny-by-default, then to a hard error; 1.99 made `no_mangle_generic_items` a hard error. The Rust release process also starts **crater** runs for each cycle, which try the upcoming compiler on public crates so that many regressions are caught before they reach stable. Private code is not in that sample, which is why your own beta job matters. ## Containing it in a team - **Pin** the toolchain in `rust-toolchain.toml` and bump it by pull request, so an upgrade is a reviewed change with a clean diff rather than a surprise on release day. - **Run a beta job.** Beta is the next stable release; a failure there gives six weeks to fix the code or report a regression upstream. - **Keep nightly jobs advisory**, allowed to fail, if you run them at all. - **Read the Compatibility Notes** for every release you skip over, not just the latest one. - **Fix future-incompatibility warnings** when they first appear, in your code or by updating the dependency that triggers them. - **Report real regressions.** If a release breaks code the notes do not mention, it may be a bug, and a beta-stage report can get the fix backported before stable.

  • Why does a new warning in a crates.io dependency not fail a Rust build that uses `-D warnings`?
    Cargo compiles registry dependencies with `--cap-lints allow`, so their lints are capped and never become errors in your build. Path dependencies, such as workspace members, are not capped, so `-D warnings` does apply to them. Force-warn lints and the future-incompatibility warnings rustc deliberately reports for dependencies still appear.
  • What does `cargo report future-incompatibilities` show a Rust team?
    It displays the future-incompatibility warnings recorded during previous builds: warnings for changes that may become hard errors and stop dependencies building in a future rustc. It turns a buried warning into a list of crates to update or fix before the release that makes it an error.

  • The stability promise means no new Rust release can ever reject code that compiled.
  • A new stable release can change an existing keyword's meaning in all editions.
  • New warnings in crates.io dependencies fail your build under -D warnings.
  • Inference failures after an upgrade mean the compiler has a regression bug.
  • Pinning the toolchain is unnecessary because stable never breaks anything.

Assumes Rust 1.99.1; the examples are compatibility notes from Rust 1.66, 1.80, 1.91 and 1.99.