Skip to content

Commit

Permalink
Rollup merge of rust-lang#98764 - InfRandomness:miri-rustdoc, r=jyn514
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
RalfJung committed Jul 3, 2022
2 parents 11e7aa4 + c5381b4 commit 8974fa3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ impl<'a> Builder<'a> {
doc::RustcBook,
doc::CargoBook,
doc::Clippy,
doc::Miri,
doc::EmbeddedBook,
doc::EditionGuide,
),
Expand Down
34 changes: 29 additions & 5 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -707,7 +713,7 @@ macro_rules! tool_doc {
target,
"doc",
$path,
SourceType::InTree,
source_type,
&[],
);

Expand All @@ -723,20 +729,38 @@ 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(),
));
}
}
}
}
}
}

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!(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 {
Expand Down

0 comments on commit 8974fa3

Please sign in to comment.