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
You also don't need to install your development version. You could just make symlink from somewhere in your $PATH to the rustc binary that lives somewhere inside the source tree/build directory, the compiler will find its dynamically linked dependencies and it will emit binaries that know about that path too (if even dynamically linked).
Usually when dealing with rustup
, you're dealing with toolchains–a single installation of the Rust compiler. There are 3 major release channels:
The channel can be appended with optional date and host names: channel[-date][-host]
.
You can install multiple toolchains using rustup
:
rustup toolchain install nightly
rustup toolchain install stable-x86_64-pc-windows-msvc
Be careful when nightly is installed as any updates using rustup update
will also update stable.
You can have different level of overrides:
# command level
rustc +beta <command>
cargo +beta <command>
# environment level
export RUSTUP_TOOLCHAIN=nightly-2019-05-22
# directory level
rustup override set stable
The toolchain configuration can also be version controlled using a rust-toolchain
file, which contains just the toolchain name.
$ cat rust-toolchain
nightly-2019-05-22
No host name can be configured in the rust-toolchain
file.
The override precedence is:
cargo +beta
RUSTUP_TOOLCHAIN
environment variablerustup override set beta
rust-toolchain
fileReference: https://github.com/rust-lang/rustup.rs#toolchain-specification
Try envirius.
It allows you to create any number of environments with any version of the rust.
For the first time it will download the source code of the rust and will compile it. And it will take some time. But second and subsequent attempts will takes under 10 seconds as it just will copy the binaries into the target environment.
For example:
➥ nv mk --rust=0.9
Creating environment: rust-0.9 ...
* installing rust==0.9 ...
* done (in 5 secs.)
➥ nv ls
Available environment(s):
rust-0.9
➥ nv on rust-0.9
Environment rust-0.9 activated.
(rust-0.9) ➥ rustc -v
rustc 0.9
Try to configure your IDE. Though I am working on Windows computer, I think the idea is similar to Ubuntu.
First, I've installed 3 versions of Rust into:
C:\Rust\64 beta MSVC 1.9
C:\Rust\64 nightly MSVC 1.10
C:\Rust\64 stable MSVC 1.8
Then I configured my IDE (in this case, IntelliJ IDEA 2016 + Rust Plug-In) to use different versions of Rust depending on build selector.
After this I can compile my code with different Rust versions just by selecting build-config from toolbar.
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:
Sure. In the development version, use the --prefix
option to ./configure
, e.g. --prefix=~/opt/rust-dev
, and then its installed files will be contained entirely inside that directory.