Skip to content

Commit cf68714

Browse files
authored
Don't store build check rmeta (#1200)
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`.
1 parent 7d4a719 commit cf68714

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ fn has_feature(feature: &str) -> bool {
205205
fn can_compile<T: AsRef<str>>(test: T) -> bool {
206206
use std::process::Stdio;
207207

208-
let out_dir = var("OUT_DIR").unwrap();
209208
let rustc = var("RUSTC").unwrap();
210209
let target = var("TARGET").unwrap();
211210

@@ -229,8 +228,9 @@ fn can_compile<T: AsRef<str>>(test: T) -> bool {
229228
.arg("--emit=metadata") // Do as little as possible but still parse.
230229
.arg("--target")
231230
.arg(target)
232-
.arg("--out-dir")
233-
.arg(out_dir); // Put the output somewhere inconsequential.
231+
.arg("-o")
232+
.arg("-")
233+
.stdout(Stdio::null()); // We don't care about the output (only whether it builds or not)
234234

235235
// If Cargo wants to set RUSTFLAGS, use that.
236236
if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {

0 commit comments

Comments
 (0)