Skip to content

Commit bb6ff20

Browse files
committed
fix: change the way to decide whether there's a RUSTC_WORKSPACE_WRAPPER
Signed-off-by: Bugen Zhao <[email protected]>
1 parent 7025295 commit bb6ff20

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
@@ -1245,13 +1245,12 @@ where
12451245

12461246
let maybe_rustc_executable = if is_rustc_like(executable) {
12471247
Some(executable.to_path_buf())
1248-
} else if env.iter().any(|(k, _)| k == OsStr::new("CARGO")) {
1249-
// If not, detect the scenario where cargo is configured to wrap rustc with something other than sccache.
1250-
// This happens when sccache is used as a `RUSTC_WRAPPER` and another tool is used as a
1251-
// `RUSTC_WORKSPACE_WRAPPER`. In that case rustc will be the first argument rather than the command.
1252-
//
1253-
// The check for the `CARGO` env acts as a guardrail against false positives.
1254-
// https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-reads
1248+
} else if env
1249+
.iter()
1250+
.any(|(k, _)| k == OsStr::new("RUSTC_WORKSPACE_WRAPPER") || k == OsStr::new("CARGO"))
1251+
{
1252+
// When sccache is used as a `RUSTC_WRAPPER` and another tool is used as a `RUSTC_WORKSPACE_WRAPPER`,
1253+
// rustc will be the first argument rather than the command.
12551254
args.iter()
12561255
.next()
12571256
.filter(|arg1| is_rustc_like(arg1))

0 commit comments

Comments
 (0)