Skip to content

Commit 6b96f06

Browse files
BugenZhaosylvestre
authored andcommitted
fix: change the way to decide whether there's a RUSTC_WORKSPACE_WRAPPER
Signed-off-by: Bugen Zhao <[email protected]>
1 parent 8f0af50 commit 6b96f06

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/compiler/compiler.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,13 +1292,12 @@ where
12921292

12931293
let maybe_rustc_executable = if is_rustc_like(executable) {
12941294
Some(executable.to_path_buf())
1295-
} else if env.iter().any(|(k, _)| k == OsStr::new("CARGO")) {
1296-
// If not, detect the scenario where cargo is configured to wrap rustc with something other than sccache.
1297-
// This happens when sccache is used as a `RUSTC_WRAPPER` and another tool is used as a
1298-
// `RUSTC_WORKSPACE_WRAPPER`. In that case rustc will be the first argument rather than the command.
1299-
//
1300-
// The check for the `CARGO` env acts as a guardrail against false positives.
1301-
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-reads
1295+
} else if env
1296+
.iter()
1297+
.any(|(k, _)| k == OsStr::new("RUSTC_WORKSPACE_WRAPPER") || k == OsStr::new("CARGO"))
1298+
{
1299+
// When sccache is used as a `RUSTC_WRAPPER` and another tool is used as a `RUSTC_WORKSPACE_WRAPPER`,
1300+
// rustc will be the first argument rather than the command.
13021301
args.iter()
13031302
.next()
13041303
.filter(|arg1| is_rustc_like(arg1))

0 commit comments

Comments
 (0)