Skip to content

Commit 9dad908

Browse files
committed
Fix generating rustc docs with non-default lib directory.
1 parent 32efcfc commit 9dad908

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/bootstrap/builder.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -710,15 +710,15 @@ impl<'a> Builder<'a> {
710710

711711
/// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic
712712
/// library lookup path.
713-
pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Cargo) {
713+
pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Command) {
714714
// Windows doesn't need dylib path munging because the dlls for the
715715
// compiler live next to the compiler and the system will find them
716716
// automatically.
717717
if cfg!(windows) {
718718
return;
719719
}
720720

721-
add_dylib_path(vec![self.rustc_libdir(compiler)], &mut cmd.command);
721+
add_dylib_path(vec![self.rustc_libdir(compiler)], cmd);
722722
}
723723

724724
/// Gets a path to the compiler specified.
@@ -1515,6 +1515,10 @@ impl Cargo {
15151515
self.command.env(key.as_ref(), value.as_ref());
15161516
self
15171517
}
1518+
1519+
pub fn add_rustc_lib_path(&mut self, builder: &Builder<'_>, compiler: Compiler) {
1520+
builder.add_rustc_lib_path(compiler, &mut self.command);
1521+
}
15181522
}
15191523

15201524
impl From<Cargo> for Command {

src/bootstrap/doc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,10 @@ impl Step for RustcBook {
766766
if builder.config.verbose() {
767767
cmd.arg("--verbose");
768768
}
769+
// If the lib directories are in an unusual location (changed in
770+
// config.toml), then this needs to explicitly update the dylib search
771+
// path.
772+
builder.add_rustc_lib_path(self.compiler, &mut cmd);
769773
builder.run(&mut cmd);
770774
// Run rustbook/mdbook to generate the HTML pages.
771775
builder.ensure(RustbookSrc {

src/bootstrap/test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl Step for Rls {
270270
&[],
271271
);
272272

273-
builder.add_rustc_lib_path(compiler, &mut cargo);
273+
cargo.add_rustc_lib_path(builder, compiler);
274274
cargo.arg("--").args(builder.config.cmd.test_args());
275275

276276
if try_run(builder, &mut cargo.into()) {
@@ -328,7 +328,7 @@ impl Step for Rustfmt {
328328
t!(fs::create_dir_all(&dir));
329329
cargo.env("RUSTFMT_TEST_DIR", dir);
330330

331-
builder.add_rustc_lib_path(compiler, &mut cargo);
331+
cargo.add_rustc_lib_path(builder, compiler);
332332

333333
if try_run(builder, &mut cargo.into()) {
334334
builder.save_toolstate("rustfmt", ToolState::TestPass);
@@ -449,7 +449,7 @@ impl Step for Miri {
449449

450450
cargo.arg("--").args(builder.config.cmd.test_args());
451451

452-
builder.add_rustc_lib_path(compiler, &mut cargo);
452+
cargo.add_rustc_lib_path(builder, compiler);
453453

454454
if !try_run(builder, &mut cargo.into()) {
455455
return;
@@ -554,7 +554,7 @@ impl Step for Clippy {
554554

555555
cargo.arg("--").args(builder.config.cmd.test_args());
556556

557-
builder.add_rustc_lib_path(compiler, &mut cargo);
557+
cargo.add_rustc_lib_path(builder, compiler);
558558

559559
builder.run(&mut cargo.into());
560560
}

0 commit comments

Comments
 (0)