Skip to content

Commit 3c4bc04

Browse files
Mark-Simulacrumeddyb
authored andcommitted
Force deterministic rustc versioning
This changes our shim such that `rustc -vV` lies to Cargo, giving it canonical output independent of the toolchain we're using. Notably, this output feeds into the -Cmetadata hash and ultimately that affects both incremental hashing (and as such what query order) and codegen unit partitioning. This should make both more deterministic. We may also need to rebuild std with this metadata hash.
1 parent f636e7c commit 3c4bc04

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

collector/src/bin/rustc-fake.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ use std::time::{Duration, Instant};
55

66
fn main() {
77
let mut args = env::args_os().skip(1).collect::<Vec<_>>();
8+
9+
if args.iter().any(|arg| arg == "-vV") {
10+
// Normally, we'd just run rustc here and return its output. But, in
11+
// practice, that output affects `-Cmetadata` and that causes
12+
// non-determinism as it feeds into the incremental hash state.
13+
//
14+
// So we return a canonical preset output.
15+
println!(
16+
"rustc 1.44.0-nightly (75208942f 2020-03-27)
17+
binary: rustc
18+
commit-hash: 75208942f6144daac669e8e382029fc33bdce841
19+
commit-date: 2020-03-27
20+
host: x86_64-unknown-linux-gnu
21+
release: 1.44.0-nightly
22+
LLVM version: 9.0"
23+
);
24+
return;
25+
}
26+
827
let rustc = env::var_os("RUSTC_REAL").unwrap();
928

1029
if let Some(count) = env::var("RUSTC_THREAD_COUNT")

0 commit comments

Comments
 (0)