Skip to content

Commit ff6aceb

Browse files
committed
feat(opt-dist): respect existing .cargo/config.toml
Respect `.cargo/config.toml` in the rustc source. This is useful when the source is from a tarball and contains vendored source settings.
1 parent e9c4eb3 commit ff6aceb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/tools/opt-dist/src/training.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn init_compiler_benchmarks(
3636
// Run rustc-perf benchmarks
3737
// Benchmark using profile_local with eprintln, which essentially just means
3838
// don't actually benchmark -- just make sure we run rustc a bunch of times.
39-
cmd(&[
39+
let mut cmd = cmd(&[
4040
env.cargo_stage_0().as_str(),
4141
"run",
4242
"-p",
@@ -61,7 +61,16 @@ fn init_compiler_benchmarks(
6161
.env("RUST_LOG", "collector=debug")
6262
.env("RUSTC", env.rustc_stage_0().as_str())
6363
.env("RUSTC_BOOTSTRAP", "1")
64-
.workdir(&env.rustc_perf_dir())
64+
.workdir(&env.rustc_perf_dir());
65+
66+
// Respect `.cargo/config.toml` in the rustc source. This is useful when the
67+
// source is from a tarball and contains vendored source settings.
68+
let dot_cargo_config_toml = env.checkout_path().join(".cargo").join("config.toml");
69+
if dot_cargo_config_toml.is_file() {
70+
cmd = cmd.arg("--cargo-config").arg(dot_cargo_config_toml);
71+
}
72+
73+
cmd
6574
}
6675

6776
/// Describes which `llvm-profdata` binary should be used for merging PGO profiles.

0 commit comments

Comments
 (0)