How to switch between Rust toolchains?

Of course the rustup default stable command works well, but the easiest way is to keep a rust-toolchain file inside your project root folder. Similar to how you’d keep a .nvm file for a Node.js project.

Please note that if you use rust-toolchain.toml instead of just rust-toolchain you will need to add needed sections similar to JSON ref and hence I prefer just the simple rust-toolchain file which doesn’t need any sections similar to Node.js’s .nvm file.

rust-toolchain

nightly

screenshot of IDE with rust-toolchain file

or

stable

Leave a Comment