Skip to content

Commit b0d831a

Browse files
authored
Rollup merge of rust-lang#98764 - InfRandomness:miri-rustdoc, r=jyn514
add Miri to the nightly docs This is a follow-up to rust-lang#97773 and to rust-lang#98714 It adds miri to the doc.rust-lang.org/nightly/nightly-rustc](https://doc.rust-lang.org/nightly/nightly-rustc/
2 parents ff5e5ec + ed92d88 commit b0d831a

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ impl<'a> Builder<'a> {
694694
doc::RustcBook,
695695
doc::CargoBook,
696696
doc::Clippy,
697+
doc::Miri,
697698
doc::EmbeddedBook,
698699
doc::EditionGuide,
699700
),

src/bootstrap/doc.rs

+29-5
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl Step for Rustc {
643643
}
644644

645645
macro_rules! tool_doc {
646-
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
646+
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => {
647647
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
648648
pub struct $tool {
649649
target: TargetSelection,
@@ -699,6 +699,12 @@ macro_rules! tool_doc {
699699
t!(fs::create_dir_all(&out_dir));
700700
t!(symlink_dir_force(&builder.config, &out, &out_dir));
701701

702+
let source_type = if $in_tree == true {
703+
SourceType::InTree
704+
} else {
705+
SourceType::Submodule
706+
};
707+
702708
// Build cargo command.
703709
let mut cargo = prepare_tool_cargo(
704710
builder,
@@ -707,7 +713,7 @@ macro_rules! tool_doc {
707713
target,
708714
"doc",
709715
$path,
710-
SourceType::InTree,
716+
source_type,
711717
&[],
712718
);
713719

@@ -723,20 +729,38 @@ macro_rules! tool_doc {
723729
cargo.rustdocflag("--show-type-layout");
724730
cargo.rustdocflag("--generate-link-to-definition");
725731
cargo.rustdocflag("-Zunstable-options");
726-
builder.run(&mut cargo.into());
732+
if $in_tree == true {
733+
builder.run(&mut cargo.into());
734+
} else {
735+
// Allow out-of-tree docs to fail (since the tool might be in a broken state).
736+
if !builder.try_run(&mut cargo.into()) {
737+
builder.info(&format!(
738+
"WARNING: tool {} failed to document; ignoring failure because it is an out-of-tree tool",
739+
stringify!($tool).to_lowercase(),
740+
));
741+
}
742+
}
727743
}
728744
}
729745
}
730746
}
731747

732-
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"]);
748+
tool_doc!(
749+
Rustdoc,
750+
"rustdoc-tool",
751+
"src/tools/rustdoc",
752+
["rustdoc", "rustdoc-json-types"],
753+
in_tree = true
754+
);
733755
tool_doc!(
734756
Rustfmt,
735757
"rustfmt-nightly",
736758
"src/tools/rustfmt",
737759
["rustfmt-nightly", "rustfmt-config_proc_macro"],
760+
in_tree = true
738761
);
739-
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
762+
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true);
763+
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false);
740764

741765
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
742766
pub struct ErrorIndex {

0 commit comments

Comments
 (0)