From 413a6bc3f6949928fb503f5d8b51b304180550af Mon Sep 17 00:00:00 2001 From: Ross Sullivan Date: Fri, 2 Oct 2026 18:33:44 +0900 Subject: [PATCH 1/4] feat: Added -Zshared-blob-storage unstable feature --- doc/book/src/reference/unstable.md | 16 ++++++++++++++++ src/workspace/features.rs | 2 ++ tests/testsuite/cargo/z_help/stdout.term.svg | 20 +++++++++++--------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/doc/book/src/reference/unstable.md b/doc/book/src/reference/unstable.md index cb99de76598..d8a424d6c2b 100644 --- a/doc/book/src/reference/unstable.md +++ b/doc/book/src/reference/unstable.md @@ -101,6 +101,7 @@ Each new feature described below should explain how to use it. * [json-target-spec](#json-target-spec) --- Allows the use of `.json` custom target specs. * [hint-msrv](#hint-msrv) --- Allows Cargo to set `-Zhint-msrv` * [mem-stats](#mem-stats) --- Reports peak memory usage per build unit in `--timings`. + * [shared-blob-storage](#shared-blob-storage) --- Deduplicates build artifacts between workspaces * rustdoc * [rustdoc-map](#rustdoc-map) --- Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/). * [scrape-examples](#scrape-examples) --- Shows examples within documentation. @@ -2077,6 +2078,21 @@ option: hint-msrv = true ``` +## shared-blob-storage +* Tracking Issue: [rust-lang/cargo#17453](https://github.com/rust-lang/cargo/issues/17453) + +Enables Cargo to automatically deduplicate files across build units and workspaces by hardlink/reflinking +against a shared content addressable blob storage located in `~/.cargo/blobs`. + +You can set this via your global `~/.cargo/config.toml`, and nightly Cargo will +automatically use it, while stable Cargo will silently ignore the unstable +option: + +```toml +[unstable] +shared-blob-storage = true +``` + ## builtin-dependencies * Tracking Issue: [rust-lang/cargo#16960](https://github.com/rust-lang/cargo/issues/16960) - RFC: [rust-lang/rfcs#3875](https://rust-lang.github.io/rfcs/3875-build-std-explicit-dependencies.html) diff --git a/src/workspace/features.rs b/src/workspace/features.rs index bcdc38de967..2338abff7b5 100644 --- a/src/workspace/features.rs +++ b/src/workspace/features.rs @@ -930,6 +930,7 @@ unstable_cli_options!( script: bool = ("Enable support for single-file, `.rs` packages"), section_timings: bool = ("Enable support for extended compilation sections in --timings output"), separate_nightlies: bool, + shared_blob_storage: bool = ("Enable shared blob storage"), skip_rustdoc_fingerprint: bool, target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"), trim_paths: bool = ("Enable the `trim-paths` option in profiles"), @@ -1469,6 +1470,7 @@ impl CliUnstable { "sbom" => self.sbom = parse_empty(k, v)?, "section-timings" => self.section_timings = parse_empty(k, v)?, "separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?, + "shared-blob-storage" => self.shared_blob_storage = parse_empty(k, v)?, "checksum-freshness" => self.checksum_freshness = parse_empty(k, v)?, "skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?, "script" => self.script = parse_empty(k, v)?, diff --git a/tests/testsuite/cargo/z_help/stdout.term.svg b/tests/testsuite/cargo/z_help/stdout.term.svg index 7f17c79c0c4..36fbc3b80aa 100644 --- a/tests/testsuite/cargo/z_help/stdout.term.svg +++ b/tests/testsuite/cargo/z_help/stdout.term.svg @@ -1,4 +1,4 @@ - +