Skip to content

Commit 2a4b4ff

Browse files
authored
Merge pull request #20159 from Veykril/push-kyssnlrxlwsl
Always couple `--compile-time-deps` with
2 parents 4a6bd40 + ea88dbe commit 2a4b4ff

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/tools/rust-analyzer/crates/project-model/src/build_dependencies.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,6 @@ impl WorkspaceBuildScripts {
409409
cmd.arg("--target-dir").arg(target_dir);
410410
}
411411

412-
// --all-targets includes tests, benches and examples in addition to the
413-
// default lib and bins. This is an independent concept from the --target
414-
// flag below.
415-
if config.all_targets {
416-
cmd.arg("--all-targets");
417-
}
418-
419412
if let Some(target) = &config.target {
420413
cmd.args(["--target", target]);
421414
}
@@ -463,14 +456,26 @@ impl WorkspaceBuildScripts {
463456
cmd.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly");
464457
cmd.arg("-Zunstable-options");
465458
cmd.arg("--compile-time-deps");
466-
} else if config.wrap_rustc_in_build_scripts {
467-
// Setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself. We use
468-
// that to compile only proc macros and build scripts during the initial
469-
// `cargo check`.
470-
// We don't need this if we are using `--compile-time-deps` flag.
471-
let myself = std::env::current_exe()?;
472-
cmd.env("RUSTC_WRAPPER", myself);
473-
cmd.env("RA_RUSTC_WRAPPER", "1");
459+
// we can pass this unconditionally, because we won't actually build the
460+
// binaries, and as such, this will succeed even on targets without libtest
461+
cmd.arg("--all-targets");
462+
} else {
463+
// --all-targets includes tests, benches and examples in addition to the
464+
// default lib and bins. This is an independent concept from the --target
465+
// flag below.
466+
if config.all_targets {
467+
cmd.arg("--all-targets");
468+
}
469+
470+
if config.wrap_rustc_in_build_scripts {
471+
// Setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself. We use
472+
// that to compile only proc macros and build scripts during the initial
473+
// `cargo check`.
474+
// We don't need this if we are using `--compile-time-deps` flag.
475+
let myself = std::env::current_exe()?;
476+
cmd.env("RUSTC_WRAPPER", myself);
477+
cmd.env("RA_RUSTC_WRAPPER", "1");
478+
}
474479
}
475480
Ok(cmd)
476481
}

0 commit comments

Comments
 (0)