Skip to content

v2.2.0: safe remote C/C++ hits, faster Windows keys, cross-host registry reuse

Latest

Choose a tag to compare

@pecorino-bot pecorino-bot released this 18 Nov 21:50
Immutable release. Only release title and notes can be modified.
v2.2.0
c23fcf4

Kache 2.2.0 fixes a remote C/C++ hit that could leave a compile without its object, makes Windows key computation much cheaper, and shares registry crates between Windows and Linux hosts. It adds kache key explain and kache key diff for debugging misses across hosts, and an opt-in cleanup of old test binaries.

cargo install kache --locked --version 2.2.0
kache init
kache doctor --probe

Highlights

  • Fix C/C++ remote hits that returned success without writing the object file, and C++ files that include <regex> compiling uncached on Linux.
  • Cut Windows key time: small inputs use the file-hash memo, a file read twice in one closure is read once, and kache doctor reports slow keys and a memo that cannot work on the filesystem.
  • Share clean registry crates between Windows and Linux hosts, pull 32 transfers at a time in kache sync --pull, and explain a miss with kache key diff.

Added

  • Miss diagnostics: kache key explain prints the cache-key inputs of one rustc invocation as JSON without running rustc. kache key diff names the fields that differ between two of those documents, so a path separator, remap prefix or host line shows up by name. #1904 by @jleni.

  • Superseded test binaries: cache.auto_clean_superseded_executables keeps the N newest builds of each test binary, program, example and bench, and the daemon's hourly cleanup removes older ones. It is off by default. Builds are ranked by when Cargo last wrote the unit's fingerprint, not by last use: if you build one test with several feature sets, a binary still in use can rank below newer builds and be removed. #1965, #1976 by @jleni and @TastyCZ.

    [cache]
    auto_clean_superseded_executables = 2
  • Tree guard exclusions: a workspace can leave tool output such as node_modules out of the whole-workspace check that gates input predictions, so fresh worktrees reuse recorded inputs. Off unless set. #1927 by @jleni.

    # .kache.toml at the workspace root
    [workspace]
    guard_exclude = ["node_modules"]
  • Stats: hits served from a shared readonly_store are counted apart from own-store hits. kache report and kache stats --last-build show how often a first incremental compile found a seed donor, with seeded and unseeded compile times. #1928, #1931 by @jleni.

  • kache doctor on Windows: a new check names a workspace, Cargo home or target directory that is not on NTFS (ReFS and Dev Drive included), where the file-hash memo cannot work. Another reports the median key time of the latest build. #1978 by @jleni.

Fixed

  • C/C++ remote hits: a -c compile could take a remote hit on an entry holding only -E output, exit 0 and write no object, so the build failed later at ar or the link step. Remote entries now pass the same check as local ones, and -E and -c of one source no longer share a key. nvcc had the same gap. #1973 by @jleni.
  • C/C++ coverage: C++ files that include <regex> compile cached again on Linux. An indirect token paste in #if is no longer refused as a header probe. -I order is keyed only when it can change which header is found, so build scripts that shuffle include directories hit. #1977, #1899, #1932, #1938 by @jleni.
  • Cross-checkout outputs: a proc macro that writes CARGO_MANIFEST_DIR into generated code (rust-embed in debug builds) no longer has its output restored into another checkout. kache declines to store outputs that name their checkout. #1924 by @jleni.
  • Cross-host reuse: clean registry crates get the same key on Windows and Linux, dep-info stored on Windows restores on Linux, and -Zthreads no longer splits the cache. A registry unit keys the same whether kache keys it before or after compiling. C objects are stored under their Cargo package, so a Cargo.lock-scoped kache sync --pull fetches them. #1903, #1915, #1900, #1901 by @jleni.
  • Build scripts: a script whose rerun-if-changed path is missing runs on every build again instead of replaying a stale result, such as an old timestamp. #1926 by @jleni.
  • Incremental builds: reverting, rebasing or switching back to code the cache holds restores the crate instead of recompiling it. Checks sent to target/check keep target/ tagged, so it can still seed other worktrees. #1930, #1959 by @jleni.
  • Clippy: units of a profile that selects a codegen backend by name no longer pass through uncached under clippy-driver. #1960 by @jleni.
  • Windows install and daemon: cargo install kache no longer fails with "Access is denied" when it replaces the running engine. The daemon runs from a per-user copy of the engine. #1954, #1963 by @jleni.
  • Windows linkers: a linker wrapper that forwards to link.exe or lld-link.exe is keyed by its bytes, so build scripts, proc macros and binaries linked through it are cacheable again. #1897 by @jleni.
  • Windows correctness: the file-hash memo knows the boot time on Windows and serves no row recorded before it, and a workspace source's tree walk reads files the way Windows does. #1940, #1943, #1941, #1920 by @TastyCZ and @jleni.
  • Daemon and remote: a compile no longer stalls indefinitely behind a slow remote; the remote operation is abandoned at its deadline. A compile put retries when the index lock is busy. #1902, #1907 by @jleni.
  • Unicode paths: equivalent spellings of a non-ASCII path (NFC and NFD) stay distinct outside the configured path prefixes. #1956 by @jleni.
  • macOS: a restore never exposes a half-replaced debug bundle. #1934 by @jleni.
  • Shims and init: kache init --shims --from-path no longer runs unknown executables found on PATH, and the completion block kache init writes to ~/.profile is POSIX sh. #1896, #1925 by @jleni.

Performance

  • Windows keys: key inputs of any size use the file-hash memo, a store records hashes for small outputs, a file named twice in one closure is read once, and a native MSVC link keys its resource by bytes only. #1942, #1978, #1950, #1922 by @TastyCZ and @jleni.
  • Rust hits: on Linux, a linking unit whose predicted key misses no longer runs a separate dep-info pre-pass before compiling. Concurrent units of one workspace share one tree-guard walk. A deferred seed no longer waits on its marker flush before rustc starts. #1909, #1921, #1913 by @jleni and @lightsofapollo.
  • C/C++: a cold C miss costs less per file, cached hits stop re-deriving include shadowing, the compiler probe memo hits under the daemon, and units with __has_include probes keep their directory stamps. #1910, #1908, #1958, #1962 by @jleni.
  • macOS: debug bundles restore as clones of stored files instead of copies. #1929 by @jleni.
  • Remote and store: kache sync --pull keeps at least 32 transfers in flight whatever the daemon's S3 concurrency. Tombstone pruning holds the index write lock in short transactions. #1898, #1964 by @jleni and @TastyCZ.

Upgrading

  • Cache keys move from version 34 to 35. Expect misses while local and remote caches refill after the upgrade. No manual cache deletion is required.
  • On macOS, executables built with debug info miss once and relink after the upgrade.
  • Kache builds with Rust 1.100.0. The minimum supported Rust stays 1.95 for kache and 1.93 for kache-core.

Contributors

Credits include authors and coauthors of adopted contributions.

jleni lightsofapollo TastyCZ

Full changelog: v2.1.1...v2.2.0