Stable vs nightly Rust channels
Understand the difference between Rust's stable, beta, and nightly release channels, why Axum development uses stable, and how to safely switch toolchains for experimentation.
Rust ships new versions through three separate release channels: stable, beta, and nightly. These channels control which compiler features and language changes you are allowed to use when you build your code. The channel you pick affects every cargo build, cargo check, and rustc command you run.
If you installed Rust using rustup (which you did earlier in this chapter), you already have at least one channel installed - almost certainly the stable one. This page explains what that means, why it matters for Axum development, and how to try nightly without breaking your projects.
What is a toolchain, and what is a channel?
A toolchain is the complete set of tools Rust provides: the compiler (rustc), the package manager and build tool (cargo), the formatter (rustfmt), the linter (clippy), and the standard library. When you run cargo build, all of these pieces work together.
A channel is a release track for the toolchain. Think of it like software versions for a phone:
- Stable is the version the Rust team has fully tested and committed to supporting. It never contains experimental features that might change or disappear. This is what most people use every day.
- Beta is a preview of what will become the next stable release. It has passed most tests but is still being verified. You won't normally need it.
- Nightly is built automatically every single day from the latest development source code. It includes brand-new features that are still being designed and tested. These features may change completely or be removed without warning.
The word "channel" just refers to which of these three tracks a particular toolchain belongs to.
Why Axum development uses stable Rust
Axum is a web framework built on top of Tokio and Hyper. The Axum team specifically designs the framework to work on Rust's stable channel. You do not need nightly to write Axum applications. In fact, using nightly can introduce problems that stable users never see.
When you create an Axum project and add axum = "0.8" to your Cargo.toml, everything compiles on stable Rust 1.80 or later (axum 0.8's minimum supported Rust version; the exact minimum version depends on the Axum release you use). You can verify this with any stable toolchain that is reasonably up to date.
The practical consequence is simple: for all the Axum code you write while learning, keep your default toolchain set to stable. Stable is predictable, well documented, and guaranteed not to change underneath you. If a code example fails to compile on stable, the problem is almost always in your code, not in the compiler.
Checking your current toolchain
Before making any changes, you should know exactly what you have installed. Run these commands in a terminal:
rustc --version
This prints the version of the compiler currently active in your shell. It looks something like:
rustc 1.100.0 (0ef1bc386 2026-11-09)
The number after rustc is the version. The text in parentheses is the commit hash and date. That output tells you two things: the version number and, less obviously, that you are on the stable channel. Stable versions look like plain numbers (1.100.0). A nightly version would look like 1.102.0-nightly or similar, with the word nightly right in the version string.
A more direct way to see everything is:
rustup show
This command prints the active toolchain, the default toolchain, and a list of all installed toolchains. For a fresh Rust installation, the output is usually:
Default host: x86_64-unknown-linux-gnu
rustup home: /home/yourname/.rustup
installed toolchains
--------------------
stable-x86_64-unknown-linux-gnu (active, default)
active toolchain
----------------
name: stable-x86_64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
x86_64-unknown-linux-gnu
The line active because: it's the default toolchain shows why this toolchain is active: no override or project file is choosing anything else, so rustup falls back to the default. The (active, default) marker next to the installed toolchain means the same thing - this is the toolchain that any new terminal window will use when nothing more specific applies.
You are on the right track:
If rustup show lists stable as both installed and active, your environment is already set up correctly for Axum development. You can continue building projects without changing anything on this page.
What nightly actually gives you
Nightly unlocks unstable features. These are language capabilities and compiler internals that the Rust team has not yet decided to support permanently. To use an unstable feature on nightly, you must add a special attribute at the top of your crate, like:
#![feature(trait_alias)]
// Trait aliases are still nightly-only as of Rust 1.100:
trait Printable = std::fmt::Display + std::fmt::Debug;
The #![feature(...)] attribute tells the nightly compiler, "I know this feature is not stable yet, and I accept that it may change." This attribute does not compile on stable at all.
Examples of features that were once nightly-only but eventually became stable include async/await itself, const generics, let else, and async closures (stable since Rust 1.85). While a feature is nightly-only, its syntax, behavior, or even existence can shift between daily builds. Code you write today may fail tomorrow morning after a rustup update.
For Axum application development, you virtually never need any of these unstable features. Axum's public API is built entirely from stable Rust constructs. The framework's own maintainers test Axum against stable Rust to guarantee that. If you find a tutorial or crate that asks you to use a nightly feature just to run Axum, treat that as a red flag - it is almost certainly unnecessary.
When you might choose nightly anyway
There are legitimate reasons to install and use nightly, even if you keep stable as your default:
- Experimenting with new Rust language features that have not been stabilized yet.
- Contributing to the Rust compiler or standard library, where nightly is the development environment.
- Testing your crate against upcoming Rust changes to catch breakage early.
- Using a third-party crate that explicitly requires nightly for a specific experimental feature. This is rare for web development but does happen in some low-level crates.
The key point: use nightly in a separate project or directory, never as your global default for Axum work. The rest of this page shows you how to do exactly that.
Installing the nightly toolchain
If you want to try nightly, you must first install it. rustup makes this a single command:
rustup toolchain install nightly
This downloads the latest nightly build for your operating system and architecture. The download can take a few minutes because it includes the compiler, standard library, and several components.
Once it finishes, check the installation:
rustup toolchain list
The output now shows both toolchains:
stable-x86_64-unknown-linux-gnu (active, default)
nightly-x86_64-unknown-linux-gnu
Installing nightly does not change your default toolchain. Stable remains active until you tell rustup otherwise. That is the safe behavior we want.
Using nightly for a single project
The cleanest way to experiment with nightly is to set a toolchain override in one specific project directory. When you do this, cargo and rustc automatically use nightly inside that directory, but stable everywhere else on your machine.
The steps are sequential because each one depends on the previous:
Step 1: Navigate to the project directory
Open a terminal and change into the project where you want to try nightly. This can be a new or existing Cargo project.
cd my-experimental-project
Step 2: Set the directory override
Tell rustup to use nightly for this directory:
rustup override set nightly
Rustup records the override in its own settings file (~/.rustup/settings.toml), keyed by the absolute path of the current directory. It writes nothing into your project folder, so the override is local to your machine and is never committed with the project. The command prints confirmation immediately.
Step 3: Verify the override is active
Check that the active toolchain changed only in this directory:
rustup show
The output now shows nightly as the active toolchain, with a line reading active because: directory override for '...' naming your project directory - but the default toolchain remains stable. If you open another terminal in a different directory, stable is still active there.
A directory override is perfect for testing because it is local to your machine, reversible, and scoped to that folder and its subdirectories. To remove it later, run rustup override unset from inside the directory.
The rust-toolchain.toml file approach
Some developers prefer to commit the toolchain choice into the project itself so that every collaborator uses the same version. You do this with a file named rust-toolchain.toml in the project root.
Create the file with this content:
[toolchain]
channel = "nightly"
Now any cargo command run inside that directory automatically uses nightly, even without a directory override. The file works for anyone who clones the project, as long as they have the nightly toolchain installed. If they don't, rustup installs it automatically the first time they run a command in that directory.
You can also pin a specific nightly date or version if you need reproducibility:
[toolchain]
channel = "nightly-2026-11-13"
Pinning to a date is useful when you depend on a specific unstable feature that changed in a later nightly. It prevents a future rustup update from silently breaking your build.
Do not commit rust-toolchain.toml unless the project truly needs nightly:
If you commit a rust-toolchain.toml that says channel = "nightly" to a repository that other people will use, you are forcing them into the nightly channel whenever they build that project. For an Axum application, that is almost never appropriate. Only use this file for genuine experimentation projects.
Switching your default toolchain
Sometimes you want to change the toolchain that applies everywhere, not just in one project. You can do that with:
rustup default nightly
After this, every new terminal window uses nightly by default. To switch back to stable:
rustup default stable
Changing the global default is the riskiest operation because it affects every project on your machine. If you set nightly as default and then forget, you might find a normally working Axum project suddenly producing strange errors after a nightly update.
Do not set nightly as your default for Axum work:
Setting nightly as the global default is a common beginner mistake. It makes every project, including stable Axum projects, compile with an unreleased compiler that can change daily. If you only need nightly for one experiment, always use a directory override or rust-toolchain.toml instead.
Keeping toolchains up to date
Rust releases a new stable version every six weeks. Nightly releases every day. To update all installed toolchains to their latest versions:
rustup update
This command updates stable, beta (if installed), and nightly all at once. You can also update a specific toolchain:
rustup update nightly
If you are using nightly with a pinned date in rust-toolchain.toml, rustup update will not change that pinned version. The pin stays until you manually edit the file.
Removing a toolchain you no longer need
Nightly builds take up disk space - often several hundred megabytes. If you finish an experiment and no longer need nightly, remove it:
rustup toolchain uninstall nightly
Before uninstalling, make sure no project directory has an override for nightly and no rust-toolchain.toml file references it. Otherwise, the next build in that directory will fail because the toolchain is missing.
Working with nightly components
Some tools like rustfmt and clippy are shipped as separate components within a toolchain. When you install nightly, these components may or may not be included depending on your platform. You can check what is available:
rustup component list --toolchain nightly
If rustfmt or clippy are listed as not installed, add them with:
rustup component add rustfmt --toolchain nightly
rustup component add clippy --toolchain nightly
The stable toolchain already includes these components by default, which is another reason stable is more convenient for everyday Axum development.
Common mistakes and how to fix them
Mistake 1: Using #![feature(...)] on stable
You copy a code example that starts with #![feature(some_feature)] and run cargo check on stable. The compiler immediately fails with:
error[E0554]: `#![feature]` may not be used on the stable release channel
This error tells you exactly what happened. The solution is not to blindly switch to nightly. First ask: do I actually need this feature? If the example is for Axum, the answer is almost always no. Find an alternative that works on stable. If you truly need the feature, create a separate project with a nightly override as shown earlier.
Mistake 2: Forgetting that nightly is active in a directory
You set a directory override to nightly, worked on an experiment, then weeks later open a terminal in that same directory and run cargo build on your main Axum project. Suddenly nothing compiles. The fix: run rustup show inside that directory. If it says nightly, run rustup override unset. Then everything returns to stable.
Mistake 3: Updating nightly without testing
You have a project pinned to a specific nightly date, but you also run rustup update nightly periodically. That updates the general nightly toolchain but does not change the pinned version in rust-toolchain.toml. So your project still uses the old nightly. If you want to move to a newer nightly, you must edit the file's date and test the build.
Mistake 4: Assuming nightly features are permanent
You write code using an unstable feature on nightly. A month later you update nightly and the code stops compiling because the feature changed. This is expected behavior for nightly. Never build something you intend to keep on nightly-only features unless you are willing to maintain it continuously.
Summary and decision guide
The stable and nightly channels are fundamentally different promises. Stable promises that your code will keep working for years. Nightly promises access to the newest ideas with no guarantee they will survive the week.
For Axum development, the decision is nearly always simple: stay on stable. Install nightly only when you have a concrete reason to experiment with unstable Rust language features, and always isolate that experimentation to a single directory using rustup override set nightly or a rust-toolchain.toml file.
If you ever find yourself confused about which toolchain is active, run rustup show. If you see the word nightly, ask whether that is really what you want for the current project. In almost every Axum case, it isn't.
This understanding of toolchains will serve you well as you continue building Axum applications. The next topics you encounter will assume you are on a recent stable Rust version, which is the environment every example in this course has been tested against.