Configure default version of Rust in a project

Viewed 648

Is it possible to configure in some configuration file default version of Rust for some project? The issue is that I have found Substrate framework and work on some project and required version of Rust is like below:

rustup install nightly-2020-06-27
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-06-27

Is it possible to configure in a project in that way that new developer while installation Rust and/or dependencies will install by default required version?

1 Answers

As documented here, you can use the rustup override command.

Directories can be assigned their own Rust toolchain with rustup override. When a directory has an override then any time rustc or cargo is run inside that directory, or one of its child directories, the override toolchain will be invoked.

For your particular example, you could use

rustup override set nightly-2020-06-27

but that will only override the toolchain for the given directory on your machine. A better solution, which will override the toolchain for all developers working on your project, would be to include a rust-toolchain.toml file along the lines of

[toolchain]
channel = "nightly-2020-07-10"
targets = [ "wasm32-unknown-unknown" ]
Related