skip to content

Compatibility over Time

Rust ships every six weeks without breaking code and makes opt-in breaking changes through editions chosen per crate. Interviewers ask how editions interoperate and what 2024 changed.

on this pageshow

explore

questions

16

In Rust, what are the stable, beta and nightly release channels, and how does a change travel from one to the next?

level: juniorimportance: must knowfreq 50%

answer

  1. one main branch, three channels
  2. a build every night
  3. beta forks every six weeks
  4. unstable gates stay on nightly

basics

~20 s

Nightly is built every night from Rust's main branch. Every six weeks beta forks from it, and the previous beta ships as the next stable release. Unstable features work only on nightly, behind #![feature] gates.

solid answer

~40 s

Rust ships from one main branch on a **train model**. **Nightly** is built from it every night and is the only channel that accepts `#![feature(...)]` gates for unstable work. Every six weeks the **beta** branch forks from main, is tested for six weeks while fixes reach it only by backport, and then becomes the next **stable** release as a new beta forks. So when 1.99 is stable, beta is 1.100 and nightly is 1.101, and a change merged today normally reaches stable two releases later, six to twelve weeks out. Stable releases come every six weeks with occasional point releases such as 1.99.1, and the project supports only the latest stable.

code

console · 4 lines
console
$ rustc --version
rustc 1.99.1 (58cf8f9c3 2026-10-13)
$ rustc +nightly --version
rustc 1.101.0-nightly (76456a688 2026-10-25)

go deeper

for a junior

Name the three channels, say that stable ships every six weeks, and say that unstable features need a nightly compiler and a #![feature] attribute.

for a middle

Walk a change from main to nightly, through the beta fork and backports, to stable, and explain why it usually lands two releases after the current stable.

for a senior

Show how a team uses the channels: build on stable, test on beta to catch regressions early, keep any nightly job advisory, and plan for only the latest stable being supported.

for a principal

Frame the train as a trade: fixed six-week cadence and a frozen beta buy predictable upgrades, at the cost that a feature which misses a fork waits a whole cycle.

## One branch, three channels Rust is developed on a single **main branch** of the rust-lang/rust repository, and it is published to users through three **release channels**. A channel is a stream of builds that rustup can install and keep up to date, so a developer can have several side by side and pick one per command or per project. | Channel | Built from | How often | What it is for | |---|---|---|---| | **nightly** | main, as of that night | every night | trying unstable features, testing the newest compiler | | **beta** | a branch forked from main | forked every six weeks, rebuilt as fixes land | the next stable release, under test | | **stable** | the beta that finished its six weeks | every six weeks, plus point releases | everyday development and production | Most teams build on **stable**. Nightly exists so that new work can be used in practice before it is frozen, and beta exists so that the next stable release gets a testing period of its own. ## How the train runs The Rust Book calls this the **train model**: a release leaves the station on a fixed timetable, and whatever is aboard rides it through beta to stable. One cycle looks like this: 1. Every commit merged to main appears in the next **nightly** build. Nightly builds are produced automatically, every day. 2. Every six weeks the **beta branch forks** from main. From then on it receives no new features; a regression found during testing is fixed on main and **backported** to beta, and a new beta build is produced. 3. Six weeks after the fork, that beta becomes the **stable release**, and a new beta forks from main for the next version. Because the schedule is fixed, a feature that misses one train simply takes the next one six weeks later. The Book points out that this removes the pressure to rush half-finished work in just before a deadline. ## Following one change to stable Version numbers make the train visible. While **1.99** is the current stable release, the beta channel is building **1.100** and nightly builds already call themselves **1.101.0-nightly**. A change merged to main today is therefore in tomorrow's nightly, misses the 1.100 beta that has already forked, and ships in **1.101**: two stable releases away, which is between six and twelve weeks depending on where in the cycle it was merged. New language and library features follow the same path, with one extra step: - the implementation lands on main **behind a feature gate**, so only nightly users who write `#![feature(name)]` can use it; - after it has been tried on nightly, the relevant team decides whether to **stabilise** it; - stabilisation removes the gate on main, and from then on the feature rides the train like any other change. ## Point releases and support - **Point releases** such as 1.99.1 ship between the six-weekly releases when a fix cannot wait. Rust 1.99.1 fixed a miscompilation of FFI `bool` return values on x86_64, a missing `wcslen` symbol on UEFI and embedded targets, and an rpath problem in `rust-lld` on macOS. - **Only the latest stable is supported.** When a new stable ships, the previous one reaches end of life, so each release is supported for six weeks. A team that needs fixes takes the next release rather than waiting for a backport to an old one. - **Beta is worth a CI job.** Few people develop on beta, but running a project's tests against it reports a regression while there is still time to fix it before the next stable release. ## What nightly is for, and what it is not Nightly is the channel for **unstable features**: anything still behind a gate can change shape or disappear between two nightlies, and the Book covers only stable features for that reason. A stable or beta compiler rejects any `#![feature]` attribute outright, with error E0554, so a crate cannot quietly depend on unstable work and still build on stable. Projects that need nightly usually **pin a dated nightly** so that their build does not change underneath them, and projects that ship on stable often add a nightly job that is allowed to fail, as an early warning rather than a gate. The result is the trade the Book calls **stability without stagnation**: stable users upgrade every six weeks without fear, while nightly gives the people building and testing new features a place to work.

  • Why would a team that ships on stable Rust run its tests against beta in CI?
    Beta is the next stable release. A regression it exposes in the team's code can be reported to the Rust project and fixed, then backported to beta, before that release reaches stable. The job is an early warning: it costs one extra build per run and turns a surprise on release day into a known issue weeks earlier.
  • Can a stable Rust build use a nightly feature by depending on a crate that enables it?
    No. `#![feature]` is a crate-level attribute, and a stable rustc rejects it with E0554 in whichever crate it appears, dependencies included. Cargo reports that the dependency could not compile, so one unconditionally gated crate anywhere in the graph puts the whole build on nightly.
  • What is a Rust point release such as 1.99.1, and when does one ship?
    A point release is a patch release of the current stable version, shipped between the six-weekly releases when a fix cannot wait for the next train. Rust 1.99.1 fixed a miscompilation of FFI `bool` returns on x86_64, a missing `wcslen` symbol on UEFI and embedded targets, and a `rust-lld` rpath problem on macOS.

A commuter line with a train every six weeks: a passenger who misses one is not stranded, but they cannot board the train that has already left the station.

  • Beta is a separate experimental fork that never becomes a stable release.
  • Stable accepts #![feature] gates if you enable the matching Cargo feature.
  • A change merged to main today ships in the very next stable release.
  • Older stable releases keep receiving security fixes for a year or more.
  • Rust ships whenever enough features pile up, with no fixed schedule.
open as a page

In Rust, why can a 2018-edition crate depend on 2021- and 2024-edition crates in one build, and what may an edition not change?

level: middleimportance: must knowfreq 50%

basics

~20 s

Each crate is compiled with its own edition, and every edition lowers to the same internal representation, so the compiled crates link normally. An edition may change keywords, syntax, lints and the prelude, but not std's types and trait impls.

open as a page

In Rust, what is an edition, how does a crate choose one, and why does 2015-edition code still compile on rustc 1.99?

level: juniorimportance: should knowfreq 48%

basics

~20 s

An edition is a language mode chosen per crate (2015, 2018, 2021 or 2024). Changes that would break old code, such as new keywords, land only in a new edition, so a crate keeps compiling until it opts in.

open as a page

In Rust 2024, why do a 2021 crate's `extern "C"` block and `#[no_mangle]` function stop compiling, and what do the fixes promise?

level: middleimportance: should knowfreq 40%

basics

~20 s

Rust 2024 requires unsafe extern blocks and writes no_mangle, export_name and link_section as #[unsafe(...)]. Each unsafe marks a promise rustc cannot check: the declared signatures match the foreign code, and the exported symbol collides with nothing.

open as a page

When `cargo fix --edition` migrates a Rust 2018 crate toward 2021, what does it change, and what must you still fix by hand?

level: middleimportance: should knowfreq 38%

basics

~20 s

It runs cargo check with the next edition's compatibility lints and applies their suggestions so the code compiles on both editions. It leaves the edition key, doctests, inactive cfg code, uninvoked macros and generated code to you.

open as a page

In Rust, a crate builds on nightly with `#![feature(iter_intersperse)]`; what does stable rustc report, and how can that nightly path stay optional?

level: middleimportance: should knowfreq 35%

basics

~20 s

Stable rustc rejects any #![feature] attribute with E0554, in your crate or in a dependency. To keep nightly optional, enable the gate through cfg_attr behind an opt-in Cargo feature and keep a stable code path for everyone else.

open as a page

In a Rust repository, what does a `rust-toolchain.toml` file pin, and what can override it for a single command?

level: middleimportance: should knowfreq 40%

basics

~20 s

A rust-toolchain.toml makes rustup use a named toolchain, such as 1.99.1 or a dated nightly, plus listed components and targets, for every command run in that directory tree. A +toolchain argument or RUSTUP_TOOLCHAIN overrides it.

open as a page

In Rust, why does an `if let` on `cache.borrow()` that calls `borrow_mut()` in its `else` panic on edition 2021 but run on 2024, and what changed for tail expressions?

level: seniorimportance: should knowfreq 35%

basics

~20 s

On 2021 the Ref temporary from cache.borrow() in an if let scrutinee lives until the whole if let ends, so borrow_mut() in else panics. Rust 2024 drops it before entering else, and also drops tail-expression temporaries before the block's locals.

open as a page

Migrating a Rust crate to the 2024 edition, why does `cargo fix --edition` append `+ use<>` to some `-> impl Trait` returns, and when can it not?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Rust 2024 makes a return-position impl Trait capture every in-scope lifetime. The impl_trait_overcaptures lint adds use<> (or use<T>) so the migrated return captures only what 2021 captured. It cannot when an argument-position impl Trait parameter would need naming.

open as a page

In Rust 1.99, `readings.into_iter()` on a `[u8; 3]` yields `&u8` in a 2018 crate but `u8` in a 2021 crate; why wasn't the impl simply made 2021-only?

level: seniorimportance: should knowfreq 26%

basics

~20 s

Editions mix in one program, and a trait impl is global, so an impl cannot exist for 2021 crates only. IntoIterator for arrays was added on all editions in 1.53; only 2015 and 2018 method-call syntax still resolves to the reference impl.

open as a page

After moving a Rust library from 2018 to 2021 with a clean `cargo fix --edition` and green tests, a downstream crate fails inside your exported `macro_rules!` macro; why?

level: seniorimportance: should knowfreq 22%

basics

~20 s

A macro's tokens carry the edition of the crate that defines it, so bumping the library changed the macro's body to 2021 rules for every caller. cargo fix only sees macros expanded inside the crate, so an uninvoked exported macro migrates silently.

open as a page

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%

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.

open as a page

As the lead migrating a forty-crate Rust service workspace to the 2024 edition, how would you sequence it, and which `cargo fix` changes need human review?

level: principalimportance: should knowfreq 30%

basics

~20 s

Migrate one package at a time: run cargo fix --edition for every feature set and target, commit, set edition = "2024", test including doctests, then reformat separately. Review what fix rewrote to preserve old meaning and fix by hand what it cannot rewrite.

open as a page

As maintainer of a widely used Rust library, how would you set its minimum supported Rust version policy, and what keeps eroding it?

level: principalimportance: should knowfreq 30%

basics

~20 s

Pick a written rule, such as latest stable or a rolling window like N-2, record it in rust-version, verify it with a CI job on that toolchain, and raise it only in minor releases. Dependencies, new std APIs and editions erode it.

open as a page

In Rust 2024, why does `ports.into_iter()` on a `Box<[u16]>` yield `u16` instead of `&u16`, and why did cargo fix rewrite it?

level: middleimportance: nice to knowfreq 15%

basics

~20 s

Rust 1.80 gave Box<[T]> a by-value IntoIterator, but before 2024 the method call boxed.into_iter() still resolved to a by-reference iterator. On 2024 it consumes the box and yields T, so cargo fix writes .iter() to keep references.

open as a page

In Rust 2024, why does `parse(raw)?;` with `fn parse<T: Default>(raw: &[u8]) -> Result<T, String>` fail with E0277 on `!: Default`, and how do you fix it?

level: seniorimportance: nice to knowfreq 10%

basics

~20 s

Rust 2024 changed never-type fallback from () to !. In parse(raw)?; nothing constrains T, so 2021 picked () through the question mark's desugaring, while 2024 picks !, which does not implement Default. Name the type, as in parse::<Header>(raw)?.

open as a page