Rust CLI rustup, Toolchains, Components, and Targets/Pin toolchain in version-controlled config

Check in a `rust-toolchain.toml` file.

Section: rust-toolchain files

Pin toolchain in version-controlled config

toml
toml
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy"]
targets = ["x86_64-unknown-linux-musl"]
Explanation

A rust-toolchain file can pin channel, components, and targets for a repo.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing rust-toolchain files
Use stable once without changing defaults
Run one command on the stable toolchain.
OpenIn sheetbashsame section
List installed toolchains
Display toolchains available on the machine.
OpenIn sheetbash2 tag match
Install nightly
Add the nightly toolchain.
OpenIn sheetbash2 tag match
Install beta
Add the beta channel toolchain.
OpenIn sheetbash2 tag match
List components
Show installed and available components for active toolchain.
OpenIn sheetbash1 tag match
List available targets
Show supported target triples.
OpenIn sheetbash1 tag match