Auto merge of #102950 - oli-obk:check_miri, r=RalfJung

Enable `x.py check` for miri

Now that the miri subtree is working properly, let's add it to x.py check.

cc `@rust-lang/miri`
This commit is contained in:
bors 2022-10-31 23:03:39 +00:00
commit 024207ab43
6 changed files with 26 additions and 53 deletions

View file

@ -621,6 +621,7 @@ impl<'a> Builder<'a> {
check::CodegenBackend, check::CodegenBackend,
check::Clippy, check::Clippy,
check::Miri, check::Miri,
check::CargoMiri,
check::Rls, check::Rls,
check::RustAnalyzer, check::RustAnalyzer,
check::Rustfmt, check::Rustfmt,

View file

@ -451,14 +451,13 @@ macro_rules! tool_check_step {
} }
tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree); tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InTree);
// Clippy and Rustfmt are hybrids. They are external tools, but use a git subtree instead // Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
// of a submodule. Since the SourceType only drives the deny-warnings // of a submodule. Since the SourceType only drives the deny-warnings
// behavior, treat it as in-tree so that any new warnings in clippy will be // behavior, treat it as in-tree so that any new warnings in clippy will be
// rejected. // rejected.
tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree);
// Miri on the other hand is treated as out of tree, since InTree also causes it to tool_check_step!(Miri, "src/tools/miri", SourceType::InTree);
// be run as part of `check`, which can fail on platforms which libffi-sys has no support for. tool_check_step!(CargoMiri, "src/tools/miri/cargo-miri", SourceType::InTree);
tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule);
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree); tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree); tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);

View file

@ -765,7 +765,7 @@ impl Step for Rustc {
} }
macro_rules! tool_doc { macro_rules! tool_doc {
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => { ($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct $tool { pub struct $tool {
target: TargetSelection, target: TargetSelection,
@ -821,12 +821,6 @@ macro_rules! tool_doc {
t!(fs::create_dir_all(&out_dir)); t!(fs::create_dir_all(&out_dir));
t!(symlink_dir_force(&builder.config, &out, &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. // Build cargo command.
let mut cargo = prepare_tool_cargo( let mut cargo = prepare_tool_cargo(
builder, builder,
@ -835,7 +829,7 @@ macro_rules! tool_doc {
target, target,
"doc", "doc",
$path, $path,
source_type, SourceType::InTree,
&[], &[],
); );
@ -851,38 +845,21 @@ macro_rules! tool_doc {
cargo.rustdocflag("--show-type-layout"); cargo.rustdocflag("--show-type-layout");
cargo.rustdocflag("--generate-link-to-definition"); cargo.rustdocflag("--generate-link-to-definition");
cargo.rustdocflag("-Zunstable-options"); cargo.rustdocflag("-Zunstable-options");
if $in_tree == true { builder.run(&mut cargo.into());
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!( tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"],);
Rustdoc,
"rustdoc-tool",
"src/tools/rustdoc",
["rustdoc", "rustdoc-json-types"],
in_tree = true
);
tool_doc!( tool_doc!(
Rustfmt, Rustfmt,
"rustfmt-nightly", "rustfmt-nightly",
"src/tools/rustfmt", "src/tools/rustfmt",
["rustfmt-nightly", "rustfmt-config_proc_macro"], ["rustfmt-nightly", "rustfmt-config_proc_macro"],
in_tree = true
); );
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true); tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false); tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]);
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)] #[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ErrorIndex { pub struct ErrorIndex {

View file

@ -509,7 +509,7 @@ impl Step for Miri {
host, host,
"run", "run",
"src/tools/miri/cargo-miri", "src/tools/miri/cargo-miri",
SourceType::Submodule, SourceType::InTree,
&[], &[],
); );
cargo.add_rustc_lib_path(builder, compiler); cargo.add_rustc_lib_path(builder, compiler);
@ -557,7 +557,7 @@ impl Step for Miri {
host, host,
"test", "test",
"src/tools/miri", "src/tools/miri",
SourceType::Submodule, SourceType::InTree,
&[], &[],
); );
cargo.add_rustc_lib_path(builder, compiler); cargo.add_rustc_lib_path(builder, compiler);

View file

@ -794,10 +794,9 @@ macro_rules! tool_extended {
$($name:ident, $($name:ident,
$path:expr, $path:expr,
$tool_name:expr, $tool_name:expr,
stable = $stable:expr, stable = $stable:expr
$(in_tree = $in_tree:expr,)? $(,tool_std = $tool_std:literal)?
$(tool_std = $tool_std:literal,)? ;)+) => {
$extra_deps:block;)+) => {
$( $(
#[derive(Debug, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct $name { pub struct $name {
@ -839,7 +838,6 @@ macro_rules! tool_extended {
#[allow(unused_mut)] #[allow(unused_mut)]
fn run(mut $sel, $builder: &Builder<'_>) -> Option<PathBuf> { fn run(mut $sel, $builder: &Builder<'_>) -> Option<PathBuf> {
$extra_deps
$builder.ensure(ToolBuild { $builder.ensure(ToolBuild {
compiler: $sel.compiler, compiler: $sel.compiler,
target: $sel.target, target: $sel.target,
@ -848,11 +846,7 @@ macro_rules! tool_extended {
path: $path, path: $path,
extra_features: $sel.extra_features, extra_features: $sel.extra_features,
is_optional_tool: true, is_optional_tool: true,
source_type: if false $(|| $in_tree)* { source_type: SourceType::InTree,
SourceType::InTree
} else {
SourceType::Submodule
},
}) })
} }
} }
@ -865,17 +859,17 @@ macro_rules! tool_extended {
// Note: Most submodule updates for tools are handled by bootstrap.py, since they're needed just to // Note: Most submodule updates for tools are handled by bootstrap.py, since they're needed just to
// invoke Cargo to build bootstrap. See the comment there for more details. // invoke Cargo to build bootstrap. See the comment there for more details.
tool_extended!((self, builder), tool_extended!((self, builder),
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true, in_tree=true, {}; Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true;
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true, in_tree=true, {}; CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true;
Clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {}; Clippy, "src/tools/clippy", "clippy-driver", stable=true;
Miri, "src/tools/miri", "miri", stable=false, in_tree=true, {}; Miri, "src/tools/miri", "miri", stable=false;
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, in_tree=true, {}; CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=true;
// FIXME: tool_std is not quite right, we shouldn't allow nightly features. // FIXME: tool_std is not quite right, we shouldn't allow nightly features.
// But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0, // But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0,
// and this is close enough for now. // and this is close enough for now.
Rls, "src/tools/rls", "rls", stable=true, in_tree=true, tool_std=true, {}; Rls, "src/tools/rls", "rls", stable=true, tool_std=true;
RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, tool_std=true, {}; RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, tool_std=true;
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {}; Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true;
); );
impl<'a> Builder<'a> { impl<'a> Builder<'a> {

View file

@ -38,6 +38,8 @@
clippy::cast_lossless, clippy::cast_lossless,
clippy::cast_possible_truncation, clippy::cast_possible_truncation,
)] )]
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
#![recursion_limit = "256"]
extern crate rustc_apfloat; extern crate rustc_apfloat;
extern crate rustc_ast; extern crate rustc_ast;