Skip to content

Commit

Permalink
Don't store build check rmeta
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
nmattia committed Oct 28, 2024
1 parent 7d4a719 commit bcb1098
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ fn can_compile<T: AsRef<str>>(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") {
Expand Down

0 comments on commit bcb1098

Please sign in to comment.