Skip to content

Commit

Permalink
feat(opt-dist): respect existing .cargo/config.toml
Browse files Browse the repository at this point in the history
Respect `.cargo/config.toml` in the rustc source.
This is useful when the source is from a tarball
and contains vendored source settings.
  • Loading branch information
weihanglo committed Jun 3, 2024
1 parent e9c4eb3 commit 89fb909
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/tools/opt-dist/src/training.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn init_compiler_benchmarks(
// Run rustc-perf benchmarks
// Benchmark using profile_local with eprintln, which essentially just means
// don't actually benchmark -- just make sure we run rustc a bunch of times.
cmd(&[
let mut cmd = cmd(&[
env.cargo_stage_0().as_str(),
"run",
"-p",
Expand All @@ -61,7 +61,16 @@ fn init_compiler_benchmarks(
.env("RUST_LOG", "collector=debug")
.env("RUSTC", env.rustc_stage_0().as_str())
.env("RUSTC_BOOTSTRAP", "1")
.workdir(&env.rustc_perf_dir())
.workdir(&env.rustc_perf_dir());

// Respect `.cargo/config.toml` in the rustc source. This is useful when the
// source is from a tarball and contains vendored source settings.
let dot_cargo_config_toml = env.checkout_path().join(".cargo").join("config.toml");
if dot_cargo_config_toml.is_file() {
cmd.arg("--cargo-config").arg(dot_cargo_config_toml);
}

cmd
}

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

0 comments on commit 89fb909

Please sign in to comment.