Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 68efd54

Browse files
committed
Run original compiler command for blacklisted crates
1 parent a9eefca commit 68efd54

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/build/cargo.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,22 @@ impl Executor for RlsExecutor {
314314
// Currently we don't cache nor modify build script args
315315
let is_build_script = *target.kind() == TargetKind::CustomBuild;
316316
if !self.is_primary_crate(id) || is_build_script {
317-
let mut cmd = Command::new(&env::var("RUSTC").unwrap_or("rustc".to_owned()));
318317
let build_script_notice = if is_build_script {" (build script)"} else {""};
319318
trace!("rustc not intercepted - {}{}", id.name(), build_script_notice);
320319

321-
// Recreate the command, minus -Zsave-analysis.
320+
// Recreate the original command, minus -Zsave-analysis. Since the
321+
// shim sets it internally, be sure not to use it.
322322
if ::CRATE_BLACKLIST.contains(&&*crate_name) {
323-
let args: Vec<_> = cmd.get_args().iter().cloned()
323+
let mut cargo_cmd = cargo_cmd.clone();
324+
let args: Vec<_> = cargo_cmd.get_args().iter().cloned()
324325
.filter(|x| x != "Zsave-analysis").collect();
325-
cmd.args_replace(&args);
326+
cargo_cmd.args_replace(&args);
327+
328+
return cargo_cmd.exec();
326329
}
330+
// TODO: Make sure we don't pass any unstable options (incl. -Zsave-analysis)
331+
// to the shim. For stable toolchains it won't accept those as arguments,
332+
// but rather it sets them internally instead to work around that
327333
return cmd.exec();
328334
}
329335

0 commit comments

Comments
 (0)