How to specify `channel` and `version` of rust toolchain

Hello, I would like to use rust-toolchain file to specify the rustc version, I would like to specify the channel and the version at the same time, but I wasn't able to find a way to do it.

for example, I would like to specify the toochain version like nightly-2019-11-12.

Any one can help on this?

2 Likes

Hi

Did you put the rust-toolchain in the same folder as the Cargo.toml file?

See GitHub - rust-lang/rust-clippy: A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/nightly/clippy/ for an example. There they use only 'nightly' as the version, but 'nightly-2019-11-12' should be valid as well.

Hello, I got error messages after changing.

info: syncing channel updates for 'nightly-2019-11-12-x86_64-unknown-linux-gnu'
info: latest update on 2019-11-12, rust version 1.40.0-nightly (bc0e288ad 2019-11-11)
error: component 'clippy' for target 'x86_64-unknown-linux-gnu' is unavailable for download for channel nightly-2019-11-12

I tried also to use stable channel, I can see that I got stable-2019-11-04 installed but while using specifying it in rust-toolchain, it doesn't seem to be working.

➜  acs git:(feature/fix-nuxt) ✗ rustup show 
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/cheng/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.40.0-nightly (4f03f4a98 2019-11-12)

➜  acs git:(feature/fix-nuxt) ✗ rustup default stable
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.39.0 (4560ea788 2019-11-04)

➜  acs git:(feature/fix-nuxt) ✗ cd server 
➜  server git:(feature/fix-nuxt) ✗ ls
askama.toml  Cargo.lock  Cargo.toml  Config.toml  diesel.toml  LICENSE  migrations  rust-toolchain  src  target  templates  tls
➜  server git:(feature/fix-nuxt) ✗ vim rust-toolchain 
➜  server git:(feature/fix-nuxt) ✗ cargo run
info: syncing channel updates for 'stable-2019-11-04-x86_64-unknown-linux-gnu'
error: no release found for 'stable-2019-11-04'

Do you need the exact nightly-2019-11-12 version?

I get the same error with nightly-2019-11-12, but nightly-2019-11-13 works fine.

No, clearly you saved my life, thanks in advance!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.