Skip to content

compile-test tests fail to run when using a custom build-dir #16567

@jakubadamw

Description

@jakubadamw

Description

I have the following in my ~/.cargo/config.toml:

[build]
build-dir = "{cargo-cache-home}/build-artifacts/{workspace-path-hash}"

and that means intermediate artifacts (including final artifacts of dependencies) get written to ~/.cargo/build-artifacts rather than the target directory (./target/{debug,release}/{build,deps,…}).

When I try to run Clippy's compile-test tests, the harness will fail with:

➜  rust-clippy git:(master) cargo uitest -- default_trait_access
   Compiling clippy v0.1.95 ([…]/Projects/Rust/rust-clippy)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 1.40s
     Running tests/compile-test.rs ([…]/.cargo/build-artifacts/17/4ed237e20fa79c/debug/deps/compile_test-fdede6d307b30bd0)

thread 'main' (10541131) panicked at tests/compile-test.rs:250:6:
called `Result::unwrap()` on an `Err` value: failed to parse rustc version info: "RUSTC_ICE"="0" "CLIPPY_CONF_DIR"="tests" /[…]/.cargo/build-artifacts/17/4ed237e20fa79c/debug/clippy-driver "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "--out-dir" OUT_DIR

Caused by:
   0: could not execute command: No such file or directory (os error 2)
   1: No such file or directory (os error 2)

The problem is here where it is assumed that clippy-driver (a final build artifact) is located in the parent directory of compile_test-… (an intermediate artifact), and that doesn't hold when build-dir is configured independently from target-dir.

Version

0f4f81df13a18212e1b3b578ccfc8d055ad120be, master as of 13 Feb 2026.

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions