How to Use rust-toolchain.toml to Pin Toolchain Versions

Pin your Rust toolchain version by creating a rust-toolchain.toml file with the desired channel and components.

Create a rust-toolchain.toml file in your project root to pin the Rust toolchain version for all developers and CI environments. This file overrides the default toolchain and ensures everyone uses the same compiler version.

[toolchain]
channel = "1.90"
components = ["rust-docs"]

When you run cargo build or rustup, it will automatically install and switch to Rust 1.90 with the rust-docs component if it isn't already installed.