Skip to content

Commit be43319

Browse files
Do not clobber RUSTDOCFLAGS
We were setting these in both Builder::cargo and here, which ended up only setting the first of the two.
1 parent 47ea6d9 commit be43319

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/bootstrap/builder.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,10 @@ pub struct Cargo {
14441444
}
14451445

14461446
impl Cargo {
1447+
pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
1448+
self.rustdocflags.arg(arg);
1449+
self
1450+
}
14471451
pub fn rustflag(&mut self, arg: &str) -> &mut Cargo {
14481452
self.rustflags.arg(arg);
14491453
self
@@ -1466,6 +1470,9 @@ impl Cargo {
14661470
}
14671471

14681472
pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
1473+
// These are managed through rustflag/rustdocflag interfaces.
1474+
assert_ne!(key.as_ref(), "RUSTFLAGS");
1475+
assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
14691476
self.command.env(key.as_ref(), value.as_ref());
14701477
self
14711478
}

src/bootstrap/doc.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -527,11 +527,9 @@ impl Step for Rustc {
527527

528528
// Build cargo command.
529529
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
530-
cargo.env(
531-
"RUSTDOCFLAGS",
532-
"--document-private-items \
533-
--enable-index-page -Zunstable-options",
534-
);
530+
cargo.rustdocflag("--document-private-items");
531+
cargo.rustdocflag("--enable-index-page");
532+
cargo.rustdocflag("-Zunstable-options");
535533
compile::rustc_cargo(builder, &mut cargo, target);
536534

537535
// Only include compiler crates, no dependencies of those, such as `libc`.
@@ -624,7 +622,7 @@ impl Step for Rustdoc {
624622
cargo.arg("--no-deps");
625623
cargo.arg("-p").arg("rustdoc");
626624

627-
cargo.env("RUSTDOCFLAGS", "--document-private-items");
625+
cargo.rustdocflag("--document-private-items");
628626
builder.run(&mut cargo.into());
629627
}
630628
}

0 commit comments

Comments
 (0)