The default file-tree created by Cargo allows parallel compilation of release and debug builds as they are located in their own directories; target/release
and target/debug
, respectively.
How difficult is it to also allow parallel compilation of stable
/nightly
-compiler. For example using the directories
target/debug/stable
target/debug/nightly
I am aware it can be done with jails/containers, but I was hoping for a somewhat more Cargo-ish solution.
Modern Rust
I believe that your main problem of rebuilding dependencies no longer exists:
I believe that this is a side-effect of the work done for incremental compilation: the compiler version (or something equivalent) is used as part of the hashing algorithm used for build artifacts. Thus, artifacts from multiple toolchains can coexist.
This does not cover the final artifact, which has a fixed name and will be overridden. Keep on reading if you really need to keep both in parallel.
Original answer
As explained in Is it possible to deactivate file locking in cargo?, you can set the environment variable
CARGO_TARGET_DIR
for each channel you are interested in: