Different shape from the closed #329 (which shared the parent's target dir and ran into build-lock contention).
A new opt-in env var TRYBUILD_INHERIT_CACHE, gated behind a new optional inherit-cache cargo feature. When the feature is enabled at build time AND the env var is set at runtime, trybuild seeds its own isolated target/tests/trybuild/<crate>/debug/ from the parent workspace's target/debug/{deps,.fingerprint,incremental,build}/ before spawning cargo. The trybuild target dir override stays — preserving lock isolation from the parent.
Seeding uses reflink-copy (CoW where the filesystem supports it, plain copy fallback elsewhere — never hardlink, to avoid corrupting the parent on cargo's truncating writes). Mtime-based staleness skips the seed if the parent hasn't changed since the last run.
When the feature is off (default) or the env var unset, behavior is bit-identical to today.
Surfacing the approach here first since it's a non-trivial implementation; PR will follow.
Different shape from the closed #329 (which shared the parent's target dir and ran into build-lock contention).
A new opt-in env var
TRYBUILD_INHERIT_CACHE, gated behind a new optionalinherit-cachecargo feature. When the feature is enabled at build time AND the env var is set at runtime, trybuild seeds its own isolatedtarget/tests/trybuild/<crate>/debug/from the parent workspace'starget/debug/{deps,.fingerprint,incremental,build}/before spawning cargo. The trybuild target dir override stays — preserving lock isolation from the parent.Seeding uses
reflink-copy(CoW where the filesystem supports it, plain copy fallback elsewhere — never hardlink, to avoid corrupting the parent on cargo's truncating writes). Mtime-based staleness skips the seed if the parent hasn't changed since the last run.When the feature is off (default) or the env var unset, behavior is bit-identical to today.
Surfacing the approach here first since it's a non-trivial implementation; PR will follow.