There is a rust-toolchain file in my project. The correct version only gets installed on first cargo (or, I guess, rustc) call. But how can I install it explicitly and switch to it, so my next rustup add call will install target on it?
I need something like
rustup toolchain --install-from-toolchain-file
rustup add my_target # target goes to this toolchain
Running any rustup command (even rustup show) inside the folder with the rust-toolchain file will cause it to install the override toolchain if it's not already installed. So you can do this:
cd path/to/my/project/
rustup target add my_target # install the toolchain and add `my_target` to it
You can also switch to a rust-toolchain.toml file and specify one or more targets:
Then just run cargo build (or any other cargo/rustc/rustup command) and it will automatically ensure the toolchain and target are both installed first.
@mbrubeck why doesn't rustup add do so btw?
It was kinda strange to call rustup show before rustup add just to install the right toolchain version. Do I probably misuse it?