Sleik
Sleik

Reputation: 351

How can I prevent Cargo from automatically trying to download a newer version of the compiler?

I need to compile an older version of Parity which only compiles with version 1.28 of the Rust compiler. To install the older version, I did this:

rustup.sh -y --default-toolchain 1.28.0

This seems to work:

root@2afa3b8dc256:/build# cargo --version
cargo 1.28.0 (96a2c7d16 2018-07-13)
root@2afa3b8dc256:/build# rustc --version
rustc 1.28.0 (9634041f0 2018-07-30)

When I try to compile the project, it immediately tries to download a new version of the compiler:

root@2afa3b8dc256:/parity# cargo build --all
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
320.1 KiB / 320.1 KiB (100 %) 271.0 KiB/s ETA:   0 s                
info: latest update on 2018-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
info: downloading component 'rustc'

How can I prevent Cargo from doing that?

Upvotes: 2

Views: 1199

Answers (1)

belst
belst

Reputation: 2525

You can specify the used toolchain version for a specific directory by using rustup override. For example:

rustup override set 1.28.0

Upvotes: 5

Related Questions