From 7dca77c89a66cae25b6007c1cfa8627ddb3f9373 Mon Sep 17 00:00:00 2001 From: InfRandomness Date: Sun, 5 Jun 2022 23:33:39 +0200 Subject: [PATCH 1/3] Add miri to the rustc docs.rs page This adds miri to https://doc.rust-lang.org/nightly/nightly-rustc/ Signed-off-by: InfRandomness --- src/bootstrap/builder.rs | 1 + src/bootstrap/doc.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 62b5416cee8af..0ef20c85f7601 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -694,6 +694,7 @@ impl<'a> Builder<'a> { doc::RustcBook, doc::CargoBook, doc::Clippy, + doc::Miri, doc::EmbeddedBook, doc::EditionGuide, ), diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index be6655ddb61d0..31eda2dc98487 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -737,6 +737,7 @@ tool_doc!( ["rustfmt-nightly", "rustfmt-config_proc_macro"], ); tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]); +tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]); #[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct ErrorIndex { From b9c8409bc849e053fb90d241fa574bd52587d5e5 Mon Sep 17 00:00:00 2001 From: InfRandomness Date: Mon, 6 Jun 2022 17:21:39 +0200 Subject: [PATCH 2/3] Add in_tree macro literal Signed-off-by: InfRandomness --- src/bootstrap/doc.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 31eda2dc98487..eb29a5e9ffc4f 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -643,7 +643,7 @@ impl Step for Rustc { } macro_rules! tool_doc { - ($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => { + ($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct $tool { target: TargetSelection, @@ -699,6 +699,12 @@ macro_rules! tool_doc { t!(fs::create_dir_all(&out_dir)); t!(symlink_dir_force(&builder.config, &out, &out_dir)); + let source_type = if $in_tree == true { + SourceType::InTree + } else { + SourceType::Submodule + }; + // Build cargo command. let mut cargo = prepare_tool_cargo( builder, @@ -707,7 +713,7 @@ macro_rules! tool_doc { target, "doc", $path, - SourceType::InTree, + source_type, &[], ); @@ -729,15 +735,22 @@ macro_rules! tool_doc { } } -tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"]); +tool_doc!( + Rustdoc, + "rustdoc-tool", + "src/tools/rustdoc", + ["rustdoc", "rustdoc-json-types"], + in_tree = true +); tool_doc!( Rustfmt, "rustfmt-nightly", "src/tools/rustfmt", ["rustfmt-nightly", "rustfmt-config_proc_macro"], + in_tree = true ); -tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]); -tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]); +tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true); +tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false); #[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct ErrorIndex { From c5381b4862bdb4765d4852494e3f742640a97547 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 30 Jun 2022 10:41:04 -0400 Subject: [PATCH 3/3] ignore rustdoc failures for out-of-tree tools --- src/bootstrap/doc.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index eb29a5e9ffc4f..3cf0f9b9f9927 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -729,7 +729,17 @@ macro_rules! tool_doc { cargo.rustdocflag("--show-type-layout"); cargo.rustdocflag("--generate-link-to-definition"); cargo.rustdocflag("-Zunstable-options"); - builder.run(&mut cargo.into()); + if $in_tree == true { + builder.run(&mut cargo.into()); + } else { + // Allow out-of-tree docs to fail (since the tool might be in a broken state). + if !builder.try_run(&mut cargo.into()) { + builder.info(&format!( + "WARNING: tool {} failed to document; ignoring failure because it is an out-of-tree tool", + stringify!($tool).to_lowercase(), + )); + } + } } } }