pub async fn remove_shared_target_dir() -> Result<Option<u64>>Expand description
Remove the shared Cargo target directory every project’s builds write
into, returning the disk space it held — None when no shared target
exists.
The garbage collector only reclaims the directory once it has been unused
for the configured window; this is the explicit drop, for when a user
wants the space back now. Unlike cargo clean, it refuses while a Cargo
build is in flight — detected by the .cargo-lock every build holds in
its profile directory — since deleting a target mid-build leaves the
survivor’s own project with a half-written graph.
§Errors
Returns an error if the cache root cannot be resolved, a Cargo build is using the directory, or the directory cannot be removed.