From 56cf3dbd1b3a6e441bc1e79b159de4f6070c278c Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Dec 2026 06:50:40 -0800 Subject: [PATCH] Validation tests: bin_exe! reads CARGO_BIN_EXE_ with option_env!, so clippy --all-targets compiles them The remote CI's Linux leg has failed "Clippy (warnings denied)" on master since at least fc9c99916d (runs 45911520903, 46004353737, 46104484064, and 46893773054 at d8735b75f0): every bin_exe! use in the validation crate's integration tests stops with "environment variable `CARGO_BIN_EXE_corpus-triage` not defined at compile time" (and corpus-pipeline, corpus-vulkan, corpus-index, command-replay), on the pinned nightly-2026-11-03. The macro read the path with env!, a compile-time error where Cargo does not set the variable. option_env! compiles either way; when the test runs, nextest's NEXTEST_BIN_EXE_ or Cargo's baked-in path is still taken first, and a missing one panics with its name instead of failing the build. Verified: the next msi job runs clippy over the validation crate with no rustc wrapper and a fresh target, at the parent's macro and at this one. --- .../tests/integration/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/metal2vulkan-validation/tests/integration/main.rs b/crates/metal2vulkan-validation/tests/integration/main.rs index 68ae59913..9efdea24f 100644 --- a/crates/metal2vulkan-validation/tests/integration/main.rs +++ b/crates/metal2vulkan-validation/tests/integration/main.rs @@ -16,7 +16,17 @@ macro_rules! bin_exe { ($name:literal) => { std::env::var_os(concat!("NEXTEST_BIN_EXE_", $name)) .map(std::path::PathBuf::from) - .unwrap_or_else(|| std::path::PathBuf::from(env!(concat!("CARGO_BIN_EXE_", $name)))) + .unwrap_or_else(|| { + // `option_env!`, not `env!`: Cargo sets `CARGO_BIN_EXE_` for a build of the + // test, but not for `cargo clippy --all-targets`, which only checks it. + std::path::PathBuf::from(option_env!(concat!("CARGO_BIN_EXE_", $name)).expect( + concat!( + "Cargo sets CARGO_BIN_EXE_", + $name, + " when it builds this test" + ), + )) + }) }; }