Installing, switchiing between different versions

I use rustup to get new versions, but I want to also get/install/use ver 1.40 too.

For Ruby, there are various apps that allow for installing and using different Ruby versions (3.0.0, 2.72, 2.6.6, etc), or VMs (Jruby, Truffleruby, etc), at the same time (in different terminal windows).

I need to install|use Rust 1.40 to compare to same code compiled with it to newer versions. How do I get|install|use 1.40, while still being able to run the latest versions, and/or others I might want to use?

Not sure if you've run across this, but the rustup book is likely helpful if you're new.

Just rustup install 1.40 to install 1.40 next to the current stable and possible nightly and whatever else you might have installed. To use something other than stable (or whatever your configured default is), you run commands with the +toolchain argument, e.g. while to compile a project with stable, you’d use e.g. cargo build, to explicitly opt into using the installed 1.40, you would use cargo +1.40 build, etc. This works for cargo, for rustc itself, etc... (though, honestly, who uses any command other than cargo?)

Also rustup show to show installed toolchains and e.g. rustup uninstall 1.40 to get rid of it.

1 Like

Thank you, worked like a charm. :slightly_smiling_face: