From bcb10985402efd3e34ed951ce0a4b7d79c7c2ea7 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Mon, 28 Oct 2024 12:42:00 +0100 Subject: [PATCH] Don't store build check rmeta This ensures the `.rmeta` files generated by `can_compile` are not written to the build output. Those metadata files can create determinism and cache invalidation issues in some build systems. Instead the output -- since it is never actually read -- is written to `/dev/null`. --- build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index cac0aeb36..a8e59615e 100644 --- a/build.rs +++ b/build.rs @@ -229,8 +229,8 @@ fn can_compile>(test: T) -> bool { .arg("--emit=metadata") // Do as little as possible but still parse. .arg("--target") .arg(target) - .arg("--out-dir") - .arg(out_dir); // Put the output somewhere inconsequential. + .arg("-o") + .arg("/dev/null"); // We don't care about the output (only whether it builds or not) // If Cargo wants to set RUSTFLAGS, use that. if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {