Skip to content

Commit 542a9c4

Browse files
committed
Propagate CARGO environment variable to nested cargo invocations
1 parent 21fabf4 commit 542a9c4

File tree

1 file changed

+5
-0
lines changed
  • collector/src/compile/execute

1 file changed

+5
-0
lines changed

collector/src/compile/execute/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ impl<'a> CargoProcess<'a> {
155155
// env vars set, but it doesn't hurt to have them.
156156
.env("RUSTC", &*FAKE_RUSTC)
157157
.env("RUSTC_REAL", &self.toolchain.components.rustc)
158+
// If the collector is being run with e.g. `cargo run --bin collector`,
159+
// then the CARGO environment variable will be incorrectly propagated to nested cargo
160+
// invocations (e.g. in the `cargo llvm-lines` profiler). This environment variable
161+
// makes sure that we override the path to Cargo with the specified cargo component.
162+
.env("CARGO", &self.toolchain.components.cargo)
158163
// We separately pass -Cincremental to the leaf crate --
159164
// CARGO_INCREMENTAL is cached separately for both the leaf crate
160165
// and any in-tree dependencies, and we don't want that; it wastes

0 commit comments

Comments
 (0)