about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-19 19:12:35 -0700
committerGitHub <noreply@github.com>2020-07-19 19:12:35 -0700
commit3981386b8e80e3ce35e70ffdac303c75d3771ea4 (patch)
tree6ed876364a0b4e6dcf45f785dfe5779aa8405ea9
parent03a47279d36162499f1140ce4a9aec2cd2bfe48f (diff)
parentbe43319b174589f61ce5d8a7b00c0567eb8cff35 (diff)
downloadrust-3981386b8e80e3ce35e70ffdac303c75d3771ea4.tar.gz
rust-3981386b8e80e3ce35e70ffdac303c75d3771ea4.zip
Rollup merge of #74514 - Mark-Simulacrum:nightly-rustc-docs, r=ollie27
Do not clobber RUSTDOCFLAGS

We were setting these in both Builder::cargo and here, which ended up only setting the first of the two.

Fixes #74511
-rw-r--r--src/bootstrap/builder.rs7
-rw-r--r--src/bootstrap/doc.rs10
2 files changed, 11 insertions, 6 deletions
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 70e5f6ac26f..737176c48f8 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1444,6 +1444,10 @@ pub struct Cargo {
 }
 
 impl Cargo {
+    pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
+        self.rustdocflags.arg(arg);
+        self
+    }
     pub fn rustflag(&mut self, arg: &str) -> &mut Cargo {
         self.rustflags.arg(arg);
         self
@@ -1466,6 +1470,9 @@ impl Cargo {
     }
 
     pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
+        // These are managed through rustflag/rustdocflag interfaces.
+        assert_ne!(key.as_ref(), "RUSTFLAGS");
+        assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
         self.command.env(key.as_ref(), value.as_ref());
         self
     }
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index b051390fc26..f8a549afc88 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -527,11 +527,9 @@ impl Step for Rustc {
 
         // Build cargo command.
         let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
-        cargo.env(
-            "RUSTDOCFLAGS",
-            "--document-private-items \
-            --enable-index-page -Zunstable-options",
-        );
+        cargo.rustdocflag("--document-private-items");
+        cargo.rustdocflag("--enable-index-page");
+        cargo.rustdocflag("-Zunstable-options");
         compile::rustc_cargo(builder, &mut cargo, target);
 
         // Only include compiler crates, no dependencies of those, such as `libc`.
@@ -624,7 +622,7 @@ impl Step for Rustdoc {
         cargo.arg("--no-deps");
         cargo.arg("-p").arg("rustdoc");
 
-        cargo.env("RUSTDOCFLAGS", "--document-private-items");
+        cargo.rustdocflag("--document-private-items");
         builder.run(&mut cargo.into());
     }
 }