diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 2d15cae4c0281..9300b94156acb 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -806,7 +806,7 @@ impl<'a> Builder<'a> { ); } - if [Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) { + if mode.is_tool() { // Tools like cargo and rls don't get debuginfo by default right now, but this can be // enabled in the config. Adding debuginfo makes them several times larger. if self.config.rust_debuginfo_tools { @@ -1012,7 +1012,7 @@ impl<'a> Builder<'a> { // be resolved because MinGW has the import library. The downside is we // don't get newer functions from Windows, but we don't use any of them // anyway. - if ![Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) { + if !mode.is_tool() { cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1"); } diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 476a85c9a49ad..b3ccb3cc3c926 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -219,7 +219,7 @@ impl Step for Rustdoc { let mut cargo = prepare_tool_cargo(builder, compiler, - Mode::Rustc, + Mode::ToolRustc, target, "check", "src/tools/rustdoc"); diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 3dbeea307c28c..7341137e20d72 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -953,7 +953,7 @@ impl Step for PlainSourceTarball { if !has_cargo_vendor { let mut cmd = builder.cargo( builder.compiler(0, builder.config.build), - Mode::Tool, + Mode::ToolRustc, builder.config.build, "install" ); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 4aa42a7522681..19599b33ebe26 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -799,13 +799,15 @@ impl Step for Rustdoc { builder.ensure(tool::Rustdoc { host: compiler.host }); // Symlink compiler docs to the output directory of rustdoc documentation. - let out_dir = builder.stage_out(compiler, Mode::Tool).join(target).join("doc"); + let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc"); t!(fs::create_dir_all(&out_dir)); builder.clear_if_dirty(&out, &rustdoc); t!(symlink_dir_force(&builder.config, &out, &out_dir)); // Build cargo command. - let mut cargo = prepare_tool_cargo(builder, compiler, target, "doc", "src/tools/rustdoc"); + let mut cargo = prepare_tool_cargo( + builder, compiler, Mode::ToolRustc, target, "doc", "src/tools/rustdoc"); + cargo.env("RUSTDOCFLAGS", "--document-private-items"); builder.run(&mut cargo); } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 7576505e29508..d16d7a520659b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -324,6 +324,15 @@ pub enum Mode { ToolRustc, } +impl Mode { + pub fn is_tool(&self) -> bool { + match self { + Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => true, + _ => false + } + } +} + impl Build { /// Creates a new set of build configuration from the `flags` on the command /// line and the filesystem `config`. diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b08227388bb61..a0b6222421d71 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1729,7 +1729,7 @@ impl Step for CrateRustdoc { let mut cargo = tool::prepare_tool_cargo(builder, compiler, - Mode::Rustc, + Mode::ToolRustc, target, test_kind.subcommand(), "src/tools/rustdoc");