Share compiled dependencies between crates

I have many Rust projects and each maintains its own target/debug/deps folder. If I understand correctly that's where it stores the compiled versions of its dependencies.
With all the duplication of dependencies this is a lot of wasted disk space.

Is there a way to tell Rust to have a shared folder for the dependencies?

this post from 2018 discussed this and mentioned the CARGO_TARGET environment variable, but looking at the list if environment variables I don't see that.

Is there a way today to share the compiled dependencies?

SCCACHE — Rust build tool // Lib.rs is the best way currently.

The target directory doesn't handle multiple projects well — small differences in cargo features and flags will cause rebuilds, and final products from different projects will overwrite each other.

4 Likes