Skip to content

Commit 73f6b08

Browse files
committed
Don't condition RUSTDOC_LIBDIR on --no-doc
In d94e7ff, `rustdoc_path` was changed to ignore `want_rustdoc` (which is just whether `--no-doc` was passed). But RUSTDOC_LIBDIR wasn't kept in sync. Rather than trying to keep `rustdoc_path` in sync with `RUSTDOC_LIBDIR`, just pass LIBDIR to the rustc shim unconditionally. This fix allows calling `ensure(doc::Step)` from a non-doc top-level Step, even if `--no-doc` was present in the command line.
1 parent dc2c356 commit 73f6b08

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::core::config::flags::Color;
1010
use crate::utils::build_stamp;
1111
use crate::utils::helpers::{self, LldThreads, check_cfg_arg, linker_args, linker_flags};
1212
use crate::{
13-
BootstrapCommand, CLang, Compiler, Config, DocTests, DryRun, EXTRA_CHECK_CFGS, GitRepo, Mode,
13+
BootstrapCommand, CLang, Compiler, Config, DryRun, EXTRA_CHECK_CFGS, GitRepo, Mode,
1414
RemapScheme, TargetSelection, command, prepare_behaviour_dump_dir, t,
1515
};
1616

@@ -851,8 +851,6 @@ impl Builder<'_> {
851851

852852
rustflags.arg("-Zmacro-backtrace");
853853

854-
let want_rustdoc = self.doc_tests != DocTests::No;
855-
856854
// Clear the output directory if the real rustc we're using has changed;
857855
// Cargo cannot detect this as it thinks rustc is bootstrap/debug/rustc.
858856
//
@@ -881,7 +879,8 @@ impl Builder<'_> {
881879
.env("RUSTC_REAL", self.rustc(compiler))
882880
.env("RUSTC_STAGE", build_compiler_stage.to_string())
883881
.env("RUSTC_SYSROOT", sysroot)
884-
.env("RUSTC_LIBDIR", libdir)
882+
.env("RUSTC_LIBDIR", &libdir)
883+
.env("RUSTDOC_LIBDIR", libdir)
885884
.env("RUSTDOC", self.bootstrap_out.join("rustdoc"))
886885
.env("RUSTDOC_REAL", rustdoc_path)
887886
.env("RUSTC_ERROR_METADATA_DST", self.extended_error_dir());
@@ -919,11 +918,6 @@ impl Builder<'_> {
919918
rustflags.arg(&format!("-Zstack-protector={stack_protector}"));
920919
}
921920

922-
if !matches!(cmd_kind, Kind::Build | Kind::Check | Kind::Clippy | Kind::Fix) && want_rustdoc
923-
{
924-
cargo.env("RUSTDOC_LIBDIR", self.rustc_libdir(compiler));
925-
}
926-
927921
let debuginfo_level = match mode {
928922
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
929923
Mode::Std => self.config.rust_debuginfo_level_std,

0 commit comments

Comments
 (0)