Open
Description
cargo has to recompile dependencies once a toolchain has updated/changed, this leaves all previous artifacts intact. However, this means when you're updating toolchains the target dir will just grow and grow.
Currently you can cargo clean
and rebuild, but it would be nice to be able to clean only the dependencies that are not compatible for the current toolchain. Perhaps cargo clean --incompatible
?
For example building a small crate
# cargo +nightly-2018-02-07 build; du -hd2 ./target
57M ./target/debug/deps
4.0K ./target/debug/examples
528K ./target/debug/.fingerprint
4.0K ./target/debug/native
18M ./target/debug/incremental
7.6M ./target/debug/build
82M ./target/debug
82M ./target
# cargo +nightly-2018-02-08 build; du -hd2 ./target
113M ./target/debug/deps
4.0K ./target/debug/examples
1.1M ./target/debug/.fingerprint
4.0K ./target/debug/native
35M ./target/debug/incremental
16M ./target/debug/build
163M ./target/debug
163M ./target
# cargo +nightly build; du -hd2 ./target
169M ./target/debug/deps
4.0K ./target/debug/examples
1.6M ./target/debug/.fingerprint
4.0K ./target/debug/native
52M ./target/debug/incremental
23M ./target/debug/build
245M ./target/debug
245M ./target
This can obviously be much more problematic on larger crates.
Metadata
Metadata
Assignees
Labels
Area: caching of dependencies, repositories, and build artifactsArea: target output directory layout, naming, and organizationCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Nightly: garbage collection