diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 6fb7b7e71e92..1282a89a5e4f 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -2542,11 +2542,6 @@ pub fn stream_cargo( } cmd.arg("--message-format").arg(message_format); - if builder.config.compile_time_deps { - cmd.arg("-Zunstable-options"); - cmd.arg("--compile-time-deps"); - } - for arg in tail_args { cmd.arg(arg); } diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 065d7e45e0f0..d5a290d804c5 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -747,6 +747,12 @@ impl Builder<'_> { // Make cargo emit diagnostics relative to the rustc src dir. cargo.arg(format!("-Zroot-dir={}", self.src.display())); + if self.config.compile_time_deps { + // Build only build scripts and proc-macros for rust-analyzer when requested. + cargo.arg("-Zunstable-options"); + cargo.arg("--compile-time-deps"); + } + // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 // Force cargo to output binaries with disambiguating hashes in the name let mut metadata = if compiler.stage == 0 {