Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
332 views
in Technique[技术] by (71.8m points)

settings - Is it possible to have multiple coexisting Rust installations?

Would it be possible to have a nightly build Rust compiler for convenience (faster build cycle, auto-update) and a dev version of Rust cloned from GitHub for experimentation purposes?

The idea is I have a binary version of Rust for my various project and a version of Rust I can hack on, without them causing havoc between each other.

If it matters, assume my OS is Ubuntu 64-bit.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The current solution is to use rustup. Once installed, you can install multiple toolchains:

rustup install nightly
rustup install stable
rustup install 1.7

If you have a local build of Rust, you can link it as a toolchain

rustup toolchain link my-development /path/to/rust/code

You can pick a default toolchain

rustup default stable

Or add an override toolchain for a specific directory on your machine only via rustup

cd /my/cool/project
rustup override set nightly

Or add an override toolchain that lives with a specific directory, like a repository, via a rust-toolchain file

cd /my/cool/project
echo "nightly" > rust-toolchain

If you want to just use a different toolchain temporarily, you can use the "plus syntax":

rustc +1.7 --help
cargo +nightly build

In other cases you can use rustup run to run any arbitrary command in a specific toolchain:

rustup run nightly any command you want here 

See also:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...