Skip to content

Opt-in seeding of trybuild target from parent workspace #330

Description

@TarunvirBains

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions