I know I can set rust nightly on a project by running rustup override set nightly
. But I was wondering if I could state it on the Cargo.toml, so if I build in another machine it'll just run with nightly from the start. So far I haven't been able to find a way to do it.
Asked
Active
Viewed 9,112 times
17

trent
- 25,033
- 7
- 51
- 90

Tomás Vallotton
- 538
- 6
- 13
-
2STEEL's answer about the `rust-toolchain` file should help you. – justinas Mar 17 '21 at 21:19
1 Answers
28
According to the documentation it is not possible to specify it in the Cargo.toml
file.
But you can create a new file called rust-toolchain.toml
containing the following:
[toolchain]
channel = "nightly"
For more options look at the section The toolchain file in the same documentation.

Sören
- 659
- 4
- 8
-
3```In these cases the toolchain can be named in the project's directory in a file called rust-toolchain.toml or rust-toolchain. If both files are present in a directory, the latter is used for backwards compatibility.``` https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file Both `rust-toolchain.toml` and `rust-toolchain` are valid. In the documentation `rust-toolchain` get's called legacy, so the preferred file should be `rust-toolchain.toml` imho. – Sören Jun 12 '22 at 05:03