Install Rust on Ubuntu 26.04 with apt install rustc cargo and you get the compiler the archive froze on release day. On our lab VM that build sat seven stable releases behind upstream, and the gap stays invisible until a crate declares a newer rust-version or a dependency leans on a language change the archive never received. Then the build fails on your machine but not on your colleague’s, and nobody knows why.
So the real decision is which toolchain owns rustc on the box, Ubuntu’s package or rustup from the Rust project. We rebuilt every step in November 2026 on an Ubuntu 26.04.1 LTS VM in Google Cloud (4 vCPU, 16 GB RAM) with Rust 1.100.0 from rustup, because build times, binary sizes and error text all drift between releases and copied numbers age badly.
Below you will find both install routes, what happens when you mix them, a real async HTTP project, release builds, ARM64 cross compiles and the update path, including the never type change that turned one of our test crates into a hard error.
The apt package versus rustup
Use rustup for anything you develop or ship, and keep the apt package for building Debian packages or for a server that compiles one pinned tool. Canonical patches the archive compiler for security, but it does not follow the six week Rust release train, so you can’t add targets, run nightly or pin a different compiler per project. Here is how the three options compared on our 26.04 box.
| Option | Compiler you get | Updates | Cross targets | Fits |
|---|---|---|---|---|
apt install rustc cargo | Archive release-day build | With the archive, no new stable releases | Limited | Packaging, one-off builds |
apt install rustc-1.97 cargo-1.97 | Newer archive build, versioned binaries | Separate versioned package | Limited | A newer archive compiler without rustup |
| rustup (sh.rustup.rs) | Current upstream stable | rustup update, same day as upstream | rustup target add | Development, CI, cross builds |
Universe also carries a rustup package. We left it out of the table because it is an older rustup than the one the upstream script installs, and the upstream script is what the Rust documentation and most CI images assume, so troubleshooting advice you find online will match it. Rustup also updates itself after the first install, which makes the starting version less important than it sounds. The trade comes down to two points.
- apt means one command, no files in your home directory, and patches with
apt upgrade. You pay for that with a compiler some newer crates refuse to build with. - rustup gives you the current compiler within hours of a release, plus clippy, rustfmt, extra targets and per-project pinning. It lives under
~/.rustupand~/.cargo, so every user who builds Rust gets a separate copy of the toolchain.
Pick one per machine. Running both is the one choice that reliably causes confusion, and the section on mixing them shows exactly where it bites.
Prerequisites and sizing
Running a Rust binary takes almost nothing, but compiling one with tokio and reqwest is CPU and memory hungry. Size the VM for the compile, not for the program.
- Ubuntu 26.04 LTS, server or desktop, with a sudo user. A box prepared with our Ubuntu 26.04 initial server setup is the baseline we assume.
- 2 vCPU and 4 GB RAM as a floor. Our first debug build of the HTTP client peaked at about 514 MiB of resident memory on 4 vCPU, and workspaces with many proc-macro crates go well past that, so production build hosts usually want 8 GB or more.
- Outbound HTTPS to static.rust-lang.org and crates.io for the toolchain and dependencies.
Rust from the Ubuntu archive with apt
Check what your mirror offers before installing anything. The default package and the versioned side packages move on different schedules, so the version you get depends on which name you ask for.
sudo apt update
apt-cache policy rustc cargo
apt-cache search --names-only '^rustc-1\.[0-9]+$'
On our VM the default rustc resolved to the release day compiler from main, with four versioned packages sitting beside it.
rustc:
Installed: (none)
Candidate: 1.93.1ubuntu1
Version table:
1.93.1ubuntu1 500
500 http://europe-west1.gce.archive.ubuntu.com/ubuntu resolute/main amd64v3 Packages
...
rustc-1.93 - Rust systems programming language
rustc-1.91 - Rust systems programming language
rustc-1.92 - Rust systems programming language
rustc-1.97 - Rust systems programming language
Install the default pair when that version is enough for what you build.
sudo apt install -y rustc cargo
Confirm which compiler landed. Watch for the “built from a source tarball” suffix, because it is how you tell a distro build from a rustup one at a glance when a colleague pastes their version into a ticket.
rustc --version
cargo --version
Both binaries live in /usr/bin and report the archive build.
rustc 1.93.1 (01f6ddf75 2026-02-11) (built from a source tarball)
cargo 1.93.1 (083ac5135 2025-12-15) (built from a source tarball)
Our terminal shows the policy lookup and both version checks together.

Need something newer but want to stay on Canonical’s builds? The versioned packages install side by side with the default one and keep their version in the binary name, so nothing that already depends on the default compiler changes underneath you. That suffix is the catch, because every script, Makefile and CI step then has to call rustc-1.97 and cargo-1.97 explicitly, while plain rustc keeps pointing at the default package.
sudo apt install -y rustc-1.97 cargo-1.97
rustc-1.97 --version
cargo-1.97 --version
Our box reported the July compiler for the versioned pair.
rustc 1.97.1 (8bab26f4f 2026-07-14) (built from a source tarball)
cargo 1.97.1 (c980f4866 2026-06-30) (built from a source tarball)
For a build host that compiles one internal tool, that is enough and you can stop here. For development, purge the apt packages first (sudo apt purge -y rustc cargo) and move on to rustup, since leaving them installed creates the split we hit two sections down.
Rust from rustup, the upstream installer
Rustup installs the toolchain into your home directory and manages every later upgrade. We ran it on a box with no C compiler on purpose, because that is what a minimal cloud image gives you and the installer’s reaction is worth seeing. Run the script as your normal user, never with sudo.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
On an interactive terminal it asks for an installation type, and option 1 (the default) gives you the stable channel with the default profile. For unattended runs such as cloud-init or a CI image build, append -s -- -y, as we did. Read the end of the output carefully, since the last two lines on our bare image were a warning rather than success, and an unattended script will happily carry on past them.
info: profile set to default
info: default host tuple is x86_64-unknown-linux-gnu
info: syncing channel updates for stable-x86_64-unknown-linux-gnu
info: latest update on 2026-11-12 for version 1.100.0 (0ef1bc386 2026-11-09)
info: downloading 6 components
info: default toolchain set to stable-x86_64-unknown-linux-gnu
stable-x86_64-unknown-linux-gnu installed - rustc 1.100.0 (0ef1bc386 2026-11-09)
Rust is installed now. Great!
...
warn: no default linker (`cc`) was found in your PATH
warn: many Rust crates require a system C toolchain to build
Rustup is telling you the compiler works but can’t link anything yet. Installing the C toolchain now skips the first error most people hit, so do it before writing any code.
sudo apt install -y build-essential
The installer appends a line to ~/.profile and ~/.bashrc, so new shells find ~/.cargo/bin on their own. Your current shell started before that, so load the environment by hand and check the three tools.
source "$HOME/.cargo/env"
rustc --version
cargo --version
rustup --version
Compiler and Cargo share a release number. Rustup has its own, and it says so, which saves you from reporting the wrong version in a bug.
rustc 1.100.0 (0ef1bc386 2026-11-09)
cargo 1.100.0 (3acc79c0c 2026-11-05)
rustup 1.29.3 (edbc831ce 2026-11-02)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: the currently active `rustc` version is `rustc 1.100.0 (0ef1bc386 2026-11-09)`
Our session showed the installer run and the version check like this.

Whenever a build behaves differently on two machines, rustup show is the first command to run. It names the active toolchain and, more usefully, the reason it is active.
rustup show
A fresh install has one toolchain, active because it’s the default.
Default host: x86_64-unknown-linux-gnu
rustup home: /home/victor/.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
Later, a rust-toolchain.toml file or a +toolchain argument changes that “active because” line. When a project mysteriously builds with an old compiler, that line usually names the override you forgot about.
When apt and rustup share a machine
We also ran the rustup script on a box that still had the apt compiler, because most “my Rust is old” questions start from that state. The installer stops, explains, and only carries on because -y was passed.
warn: It looks like you have an existing installation of Rust at:
warn: /usr/bin
warn: This could mean one of the following:
warn: - You have already installed rustup: you can quit the installer right now.
warn: - You haven't installed rustup yet, but have Rust installed from elsewhere.
warn: In the latter case, rustup can coexist with and adopt your existing Rust.
warn: To adopt, please reply `yes`, or set RUSTUP_INIT_SKIP_PATH_CHECK to yes,
warn: or pass `-y` to ignore all ignorable checks, then follow the instructions at:
warn: <https://rust-lang.github.io/rustup/installation/already-installed-rust.html>
error: cannot install while Rust is installed
warn: continuing (because the -y flag is set and the error is ignorable)
After that install both compilers sit on the PATH, and directory order decides which one runs.
which -a rustc
rustc --version
/usr/bin/rustc --version
Your login shell gets rustup’s copy, but anything with a stripped environment gets the archive one.
/home/victor/.cargo/bin/rustc
/usr/bin/rustc
/bin/rustc
rustc 1.100.0 (0ef1bc386 2026-11-09)
rustc 1.93.1 (01f6ddf75 2026-02-11) (built from a source tarball)
Here is where the real damage happens. A systemd unit, a cron job, sudo cargo or a CI runner that never sources ~/.cargo/env silently builds with the older compiler, so you chase errors you can’t reproduce in your own terminal. The rustup documentation on existing installs supports coexistence and can even register the archive compiler as a toolchain with rustup toolchain link system /usr. Our own rule is stricter, one owner per machine, because the failures above come from processes that never see your PATH. Purge the archive packages before running rustup.
sudo apt purge -y rustc cargo
sudo apt autoremove -y
Once the purge finishes, which -a rustc should list only the path under ~/.cargo/bin. If it still shows /usr/bin/rustc, run dpkg -S /usr/bin/rustc to find the package that still owns it before you go hunting through your PATH.
A first program and the missing linker
A single-file program is the quickest proof that the toolchain produces a binary end to end, linker included. Create a working directory and open the source file.
mkdir -p ~/rust-projects
cd ~/rust-projects
vim hello.rs
Paste in the program.
fn main() {
println!("Hello from Rust on Ubuntu 26.04!");
}
Our first attempt ran before build-essential was in place. Compilation itself succeeded, yet the run still failed at the link step.
error: linker `cc` not found
|
= note: No such file or directory (os error 2)
error: aborting due to 1 previous error
Rust hands the final link to the system C compiler driver even for pure Rust code, so nothing in rustup can solve this. With build-essential installed, compile and run again.
rustc hello.rs -o hello
./hello
Now the binary prints its one line.
Hello from Rust on Ubuntu 26.04!
Both attempts, before and after build-essential, side by side.

Calling rustc directly is fine as a sanity check, but real projects go through Cargo, because it handles dependencies, profiles and tests for you. If you’re weighing Rust against a language with faster compiles for a network service, our Go install guide for Ubuntu 26.04 covers the same ground for Go.
A Cargo project with real dependencies
Create a binary crate next. Cargo writes the manifest, a src/main.rs and a Git repository in one go.
cd ~/rust-projects
cargo new myapp
cd myapp
cat Cargo.toml
New crates default to the 2024 edition. Keep that in mind for the never type section, since the edition decides how much of that change hits you.
Creating binary (application) `myapp` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
name = "myapp"
version = "0.1.0"
edition = "2024"
[dependencies]
Rather than hand-editing version strings, let Cargo resolve the latest compatible releases. cargo add has been built in for years, so older guides that install the cargo-edit plugin for this are out of date.
cargo add serde --features derive
cargo add serde_json
cargo add tokio --features full
cargo add reqwest --features json
Each call prints the features it enabled and locks the tree against the highest versions compatible with the active compiler. That lock is resolved against the compiler you run, so a crate whose newest release needs a newer Rust is quietly held back to an older release instead of failing the build. Cargo wrote this manifest.
[package]
name = "myapp"
version = "0.1.0"
edition = "2024"
[dependencies]
reqwest = { version = "0.13.5", features = ["json"] }
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.154"
tokio = { version = "1.54.1", features = ["full"] }
One detail in the reqwest feature list changed since we first wrote this guide. Current reqwest turns on rustls with the aws-lc-rs provider as its default TLS backend and leaves native-tls off, so the project no longer needs libssl-dev or pkg-config. Our first build succeeded on a box that had neither, which removes the most common Rust build failure on fresh Ubuntu servers. Older tutorials, including the first version of this one, still tell you to install those two packages first, so skip that step unless you deliberately switch to native-tls. That switch needs default-features = false on the reqwest line, because adding the native-tls feature on top of the defaults keeps rustls compiled in.
An async HTTP client on reqwest and tokio
The program fetches the VM’s public address and location from ipinfo.io. That small job exercises async I/O, TLS and JSON decoding in about thirty lines, so a successful run proves most of the stack works. Replace the generated source.
vim src/main.rs
We built and ran exactly this file.
use serde::Deserialize;
#[derive(Deserialize, Debug)]
struct IpInfo {
ip: String,
city: Option<String>,
country: Option<String>,
org: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::get("https://ipinfo.io/json")
.await?
.json::<IpInfo>()
.await?;
println!("Public IP: {}", resp.ip);
if let Some(ref city) = resp.city {
println!("City: {}", city);
}
if let Some(ref country) = resp.country {
println!("Country: {}", country);
}
if let Some(ref org) = resp.org {
println!("Org: {}", org);
}
Ok(())
}
Build it. The first run downloads and compiles every dependency from source, so expect this one to be slow.
cargo build
On 4 vCPU a clean debug build took 55 seconds of wall time and peaked at 526,164 KB (about 514 MiB) of resident memory, measured with /usr/bin/time after a cargo clean. Those are the numbers to plan CI runners around, because every fresh runner without a cache pays them again. The build ended like this.
Compiling rustls-platform-verifier v0.7.1
Compiling hyper-rustls v0.27.10
Compiling reqwest v0.13.5
Compiling myapp v0.1.0 (/home/victor/rust-projects/myapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 55.15s
Run it next. Because nothing changed since the build, Cargo goes straight to executing the binary, so any delay you see here is the network call itself rather than compilation.
cargo run
Cargo sees nothing changed, skips the build, and the program prints what ipinfo.io knows about the VM. We replaced the address with a documentation IP.
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
Running `target/debug/myapp`
Public IP: 203.0.113.50
City: Brussels
Country: BE
Org: AS396982 Google LLC
The cold build and the first run, captured from our terminal.

Brussels is simply the europe-west1 region our VM ran in. After you edit main.rs, Cargo recompiles only myapp itself and reuses everything in target/, which is why later builds in a session finish in seconds instead of a minute.
Release builds and binary size
Debug builds keep symbols and skip optimisation so compiles stay fast during development. Anything you deploy should come from the release profile instead, because the runtime speed and size difference is large, and shipping a debug binary to production is a common mistake when a Dockerfile simply copies target/debug.
cargo build --release
ls -lh target/debug/myapp target/release/myapp
Our optimised build took 1 minute 39 seconds, longer than the debug build since the optimiser does real work on every crate. It produced a binary about eight times smaller.
Finished `release` profile [optimized] target(s) in 1m 39s
-rwxrwxr-x 2 victor victor 66M Nov 13 04:27 target/debug/myapp
-rwxrwxr-x 2 victor victor 8.0M Nov 13 04:29 target/release/myapp
Both numbers are bigger than the 47 MB and 3.8 MB this same program produced in the first version of this guide. Two things moved between those runs.
- The TLS stack moved into the binary. rustls with aws-lc-rs is compiled in, where the older build linked the system OpenSSL at runtime.
- The host dependency went away. The binary no longer cares which libssl the target distro ships, which is usually worth a few megabytes for containers and multi-distro releases.
If size matters more than portability, switching reqwest to native-tls with default-features = false brings the dynamic OpenSSL link back, but then every target host needs a compatible libssl and the cross compile below gets harder.
Formatting, linting and tests
The default rustup profile already ships rustfmt and clippy, so the three checks most pipelines run need no extra installs. Run them cheapest first, the way a pipeline would.
- cargo fmt — –check fails the job when code is not formatted, without rewriting files.
- cargo clippy runs the linter over your crate. Add
-- -D warningsin CI so lints fail the build. - cargo test builds the test profile and runs unit, integration and doc tests.
cargo fmt -- --check; echo fmt-rc=$?
cargo clippy
cargo test
The formatter exits 0 and clippy finishes without a warning on our code. Clippy took 35 seconds because it re-checks the dependency tree once, and the test runner confirms zero tests.
fmt-rc=0
...
Checking myapp v0.1.0 (/home/victor/rust-projects/myapp)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 35.25s
...
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Binary sizes and all three checks from the same session.

Zero tests is honest for a thirty-line program, but it is also exactly the state that lets regressions through a green pipeline. Add a #[cfg(test)] module beside the code or a tests/ directory for integration tests, and Cargo discovers both without any configuration.
Cross-compiling for ARM64
Graviton, Ampere and Axion instances usually cost less per vCPU than their x86 equivalents, so building an aarch64 binary on your x86 workstation is one of the more valuable things rustup does. Start by adding the standard library for that target.
rustup target add aarch64-unknown-linux-gnu
rustup target list --installed
Both targets now show as installed.
aarch64-unknown-linux-gnu
x86_64-unknown-linux-gnu
This project also needs an ARM64 C toolchain, both for the final link and because the aws-lc-sys crate behind rustls compiles C code for the target during the build. Ubuntu packages one as a cross compiler.
sudo apt install -y gcc-aarch64-linux-gnu
Installing the cross compiler is not enough on its own, and we learned that the slow way. Our first cargo build --release --target aarch64-unknown-linux-gnu compiled every crate and then failed at the very last step, because Cargo still handed the ARM64 objects to the host cc.
Compiling myapp v0.1.0 (/home/victor/rust-projects/myapp)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-Wl,--fix-cortex-a53-843419" ...
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: rust-lld: error: --fix-cortex-a53-843419 is only supported on AArch64
collect2: error: ld returned 1 exit status
error: could not compile `myapp` (bin "myapp") due to 1 previous error
Cargo needs to be told which linker owns the target. A project-level config keeps that mapping with the code, so CI picks it up without extra flags.
mkdir -p .cargo
vim .cargo/config.toml
Add the linker mapping.
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
Rebuild and inspect what comes out.
cargo build --release --target aarch64-unknown-linux-gnu
file target/aarch64-unknown-linux-gnu/release/myapp
ls -lh target/aarch64-unknown-linux-gnu/release/myapp
Our build finished in 58 seconds, and file confirms an ARM64 executable that expects the aarch64 dynamic loader.
Finished `release` profile [optimized] target(s) in 58.33s
target/aarch64-unknown-linux-gnu/release/myapp: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, ...
-rwxrwxr-x 2 victor victor 7.1M Nov 13 04:33 target/aarch64-unknown-linux-gnu/release/myapp
The failed link, the config fix and the finished ARM64 build in one capture.

Beyond the cross compiler we needed no ARM64 system libraries here, because the rustls default keeps OpenSSL out of the dependency tree. Switch reqwest to native-tls, or add any crate that links a C library, and you also need that library built for arm64. At that point building inside an ARM64 container or on an ARM64 runner is usually less work than maintaining a cross sysroot, because the runner already has the right libraries and nothing needs a linker override.
Cargo extensions worth adding
Two plugins that older guides recommend are now built in or retired, which changes what is worth installing on a new machine.
- cargo-edit is no longer needed.
cargo addandcargo removeship with Cargo, and on our boxcargo add clap --features derivefollowed bycargo remove clapworked with nothing extra installed. - cargo-watch is on life support by its own README, which sends users to Bacon or Watchexec instead.
- bacon is the replacement we use. It reruns
check,clippyor tests on every save and keeps the errors on screen.
Install bacon from source with its lockfile, so you build the dependency versions its author tested rather than whatever resolved today.
cargo install --locked bacon
bacon --version
Compiling it took just under three minutes on our 4 vCPU VM. That is the hidden cost of cargo install, since every tool is built from source on each machine that installs it.
Finished `release` profile [optimized] target(s) in 2m 51s
Installing /home/victor/.cargo/bin/bacon
Installed package `bacon v3.26.0` (executable `bacon`)
bacon 3.26.0
Run bacon in the project directory for the default check job, or bacon clippy for lints. Across a fleet of laptops or CI runners those three minutes per tool add up quickly, so bake the tools you rely on into a base image instead of installing them in every pipeline run.
Rust already in the Ubuntu 26.04 base system
You are not the first Rust user on this box. Ubuntu 26.04 replaced GNU coreutils with the Rust uutils implementation and sudo with sudo-rs, and both arrive with the base image.
dpkg -l rust-coreutils sudo-rs | tail -2
ls --version | head -1
sudo --version | head -1
Both packages on our image had already picked up stable updates since release.
ii rust-coreutils 0.10.0-1ubuntu2~26.04.1 amd64 Universal coreutils utils, written in Rust
ii sudo-rs 0.2.13-0ubuntu1.2 amd64 Rust-based sudo and su implementations
ls (uutils coreutils) 0.10.0
sudo-rs 0.2.13-0ubuntu1.2
None of this depends on the toolchain you just installed. Canonical builds those binaries and updates them through apt whether or not rustup is present, so removing your toolchain can never break ls or sudo. Our Rust coreutils on Ubuntu 26.04 guide benchmarks uutils against GNU, the sudo-rs guide covers the sudo replacement, and the Ubuntu 26.04 feature overview lists the rest of the release’s changes.
Updating Rust with rustup update
Rust ships a new stable release every six weeks, and with rustup the upgrade is one command. To show a real upgrade rather than a no-op, our lab box had the previous stable release as its stable toolchain, the state a machine installed in October would be in. Check what’s pending first.
rustup check
rustup check lists the available jump without downloading anything. It also exits 100 when an update is pending, so it doubles as a cheap probe for a monitoring script.
stable-x86_64-unknown-linux-gnu - update available: 1.99.1 (58cf8f9c3 2026-10-13) -> 1.100.0 (0ef1bc386 2026-11-09)
rustup - up to date : 1.29.3
Then update the stable channel. Naming the channel keeps the run to stable only, which matters on a machine that also carries nightly or a pinned release you don’t want touched yet.
rustup update stable
Rustup removes the old components, downloads the six new ones and names both versions in the summary line. The whole upgrade took under half a minute.
info: syncing channel updates for stable-x86_64-unknown-linux-gnu
info: latest update on 2026-11-12 for version 1.100.0 (0ef1bc386 2026-11-09)
info: removing previous version of component cargo
info: removing previous version of component clippy
info: removing previous version of component rust-docs
info: removing previous version of component rust-std
info: removing previous version of component rustc
info: removing previous version of component rustfmt
info: downloading 6 components
stable-x86_64-unknown-linux-gnu updated - rustc 1.100.0 (0ef1bc386 2026-11-09) (from rustc 1.99.1 (58cf8f9c3 2026-10-13))
info: checking for self-update (current version: 1.29.3)
The check and the upgrade, as our terminal recorded them.

Plain rustup update does the same for every installed channel and updates rustup itself, and run a second time it reports unchanged. The apt route has no equivalent, since apt upgrade only brings security and bug fixes to the archive’s compiler, never a new release.
Before running this particular update across a CI fleet, read the November 2026 release announcement, because it carries breaking changes. Cargo’s build directory layout changed, which can break scripts that reach into target/ for intermediate files, and the never type ! is now stable. The bigger one for existing code is the never type fallback change in Rust 1.100: fallback switched from () to ! in editions 2015, 2018 and 2021, matching what edition 2024 already did. We built the same edition 2021 crate with both toolchains. The previous release rejected it through the deny-by-default dependency_on_unit_never_type_fallback lint, and the new one fails with a type error.
error[E0277]: the trait bound `!: Default` is not satisfied
--> src/main.rs:6:5
|
6 | parse_or_default()?;
| ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `!`
|
= note: this error might have been caused by changes to Rust's type-inference algorithm (see issue #148922 <https://github.com/rust-lang/rust/issues/148922> for more information)
= help: you might have intended to use the type `()` here instead
The capture also shows the older lint message and the build after the fix.

Annotating the type the old lint already suggested, parse_or_default::<()>()?;, made the crate build and print Ok(()). When the error points into a dependency rather than your own code, update that crate before pinning an older compiler, because a newer release of it may already carry the annotation.
Uninstall Rust
Rustup removes itself, every toolchain and everything under ~/.cargo, including binaries you installed with cargo install such as bacon. Your project directories stay untouched, but their target/ folders keep the old build output, so delete those too if disk space was the reason for removing Rust, because on a busy workstation they are often bigger than the toolchain itself.
rustup self uninstall
With two toolchains installed, the removal reported each one before deleting the homes.
info: removing toolchains
info: uninstalling toolchain stable-x86_64-unknown-linux-gnu
info: toolchain stable-x86_64-unknown-linux-gnu uninstalled
info: uninstalling toolchain 1.99.1-x86_64-unknown-linux-gnu
info: toolchain 1.99.1-x86_64-unknown-linux-gnu uninstalled
info: removing rustup home
info: removing cargo home
info: removing rustup binaries
info: rustup is uninstalled
For the apt packages, purge them and let apt clean up the LLVM libraries they pulled in.
sudo apt purge -y rustc cargo
sudo apt autoremove -y
Always remove rustup with rustup self uninstall rather than deleting ~/.cargo and ~/.rustup by hand, because the uninstaller in the rustup release we tested also strips its . "$HOME/.cargo/env" line from your shell profiles. We wiped the directories with rm -rf once during this lab, and the next login shell greeted us with /home/victor/.profile: line 28: /home/victor/.cargo/env: No such file or directory. If you already did the same, delete that line from ~/.profile and ~/.bashrc yourself.
Troubleshooting
Every error below appeared on our lab VM during this run, quoted exactly as the tools printed it.
error: linker `cc` not found
The compiler works, but there is no system C toolchain to link with, which is the normal state of minimal cloud images. Rustup even warns about it at install time with “no default linker (`cc`) was found in your PATH”. Install build-essential and rerun the build, since nothing on the Rust side needs reinstalling.
error: cannot install while Rust is installed
The rustup script found /usr/bin/rustc from apt. Interactively it asks whether to continue, while -y continues anyway and leaves two compilers on the machine. Purge rustc and cargo with apt and run the installer again, so services and scripts without your shell profile can’t fall back to the older compiler.
rust-lld: error: –fix-cortex-a53-843419 is only supported on AArch64
You cross-compiled for aarch64-unknown-linux-gnu without telling Cargo about the cross linker, so the host cc tried to link ARM64 objects. Install gcc-aarch64-linux-gnu and add the [target.aarch64-unknown-linux-gnu] linker entry to .cargo/config.toml, as the cross-compiling section shows.
error[E0277]: the trait bound `!: Default` is not satisfied
Code that relied on never type fallback becoming () now infers !, which implements far fewer traits. Annotate the type the compiler used to pick, for example ::<()> on the generic call, or bind the result to an explicitly typed variable. On the previous toolchain the same code already failed with “this function depends on never type fallback being `()`”, so your own crate is safe if it builds cleanly there with no lint allowances. Dependencies are different, because Cargo caps their lints to a future-incompatibility note, so run cargo report future-incompatibilities on the old toolchain to find the ones that will break. For more of the patterns that fail, see what the stable never type breaks in editions 2015, 2018 and 2021.
cargo build is slow or the VM runs out of memory
The first build compiles every dependency from source, which cost us 55 seconds and about 514 MiB peak memory for this small project on 4 vCPU, and three minutes for cargo install bacon. On a 1 to 2 GB VM, add swap or cap parallel jobs with cargo build -j 2. Repeat builds reuse target/, and a Docker multi-stage build that caches the dependency layer stops CI from paying that cost on every commit.
One toolchain across a team
Once more than one person or one CI runner builds the same code, “whatever stable was when you installed” stops being good enough. The never type change above is exactly the kind of surprise that lands differently on each machine, so commit a rust-toolchain.toml to the repository and rustup switches every checkout to the same compiler automatically. We reinstalled rustup after the uninstall test and pinned our project to the previous release to confirm the override. If you removed rustup in the previous section, run the sh.rustup.rs installer again first. Current rustup downloads a pinned toolchain on first use, so teammates need nothing beyond rustup itself.
vim rust-toolchain.toml
Only the channel is required.
[toolchain]
channel = "1.99.1"
Inside the project, rustc --version and rustup show active-toolchain now report the pinned compiler and say why.
rustc 1.99.1 (58cf8f9c3 2026-10-13)
1.99.1-x86_64-unknown-linux-gnu (overridden by '/home/victor/rust-projects/myapp/rust-toolchain.toml')
How hard you pin depends on how many builders you have, and here’s how we’d run it at three sizes.
- One developer: stay on stable and run
rustup updatewhen a release lands. The pin is optional. - A team with CI: pin an exact version in
rust-toolchain.tomland bump it in a pull request, so the upgrade goes through the same review and pipeline as code. - Many runners or air-gapped builders: bake the pinned toolchain into the runner image so jobs skip the toolchain download on every run, and keep the apt compiler off those images entirely.
If you are learning the language rather than packaging it, our list of the best Rust books pairs well with this setup. For a Fedora workstation, the Python, Node.js, Go and Rust setup on Fedora covers the same toolchain.