Skip to content

Commit 024207a

Browse files
committed
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`
2 parents 95a3a72 + b35e2bf commit 024207a

File tree

6 files changed

+26
-53
lines changed

6 files changed

+26
-53
lines changed

src/bootstrap/builder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ impl<'a> Builder<'a> {
621621
check::CodegenBackend,
622622
check::Clippy,
623623
check::Miri,
624+
check::CargoMiri,
624625
check::Rls,
625626
check::RustAnalyzer,
626627
check::Rustfmt,

src/bootstrap/check.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,13 @@ macro_rules! tool_check_step {
451451
}
452452

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

src/bootstrap/doc.rs

+6-29
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ impl Step for Rustc {
765765
}
766766

767767
macro_rules! tool_doc {
768-
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => {
768+
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
769769
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
770770
pub struct $tool {
771771
target: TargetSelection,
@@ -821,12 +821,6 @@ macro_rules! tool_doc {
821821
t!(fs::create_dir_all(&out_dir));
822822
t!(symlink_dir_force(&builder.config, &out, &out_dir));
823823

824-
let source_type = if $in_tree == true {
825-
SourceType::InTree
826-
} else {
827-
SourceType::Submodule
828-
};
829-
830824
// Build cargo command.
831825
let mut cargo = prepare_tool_cargo(
832826
builder,
@@ -835,7 +829,7 @@ macro_rules! tool_doc {
835829
target,
836830
"doc",
837831
$path,
838-
source_type,
832+
SourceType::InTree,
839833
&[],
840834
);
841835

@@ -851,38 +845,21 @@ macro_rules! tool_doc {
851845
cargo.rustdocflag("--show-type-layout");
852846
cargo.rustdocflag("--generate-link-to-definition");
853847
cargo.rustdocflag("-Zunstable-options");
854-
if $in_tree == true {
855-
builder.run(&mut cargo.into());
856-
} else {
857-
// Allow out-of-tree docs to fail (since the tool might be in a broken state).
858-
if !builder.try_run(&mut cargo.into()) {
859-
builder.info(&format!(
860-
"WARNING: tool {} failed to document; ignoring failure because it is an out-of-tree tool",
861-
stringify!($tool).to_lowercase(),
862-
));
863-
}
864-
}
848+
builder.run(&mut cargo.into());
865849
}
866850
}
867851
}
868852
}
869853

870-
tool_doc!(
871-
Rustdoc,
872-
"rustdoc-tool",
873-
"src/tools/rustdoc",
874-
["rustdoc", "rustdoc-json-types"],
875-
in_tree = true
876-
);
854+
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"],);
877855
tool_doc!(
878856
Rustfmt,
879857
"rustfmt-nightly",
880858
"src/tools/rustfmt",
881859
["rustfmt-nightly", "rustfmt-config_proc_macro"],
882-
in_tree = true
883860
);
884-
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true);
885-
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false);
861+
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
862+
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]);
886863

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

src/bootstrap/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ impl Step for Miri {
509509
host,
510510
"run",
511511
"src/tools/miri/cargo-miri",
512-
SourceType::Submodule,
512+
SourceType::InTree,
513513
&[],
514514
);
515515
cargo.add_rustc_lib_path(builder, compiler);
@@ -557,7 +557,7 @@ impl Step for Miri {
557557
host,
558558
"test",
559559
"src/tools/miri",
560-
SourceType::Submodule,
560+
SourceType::InTree,
561561
&[],
562562
);
563563
cargo.add_rustc_lib_path(builder, compiler);

src/bootstrap/tool.rs

+12-18
Original file line numberDiff line numberDiff line change
@@ -794,10 +794,9 @@ macro_rules! tool_extended {
794794
$($name:ident,
795795
$path:expr,
796796
$tool_name:expr,
797-
stable = $stable:expr,
798-
$(in_tree = $in_tree:expr,)?
799-
$(tool_std = $tool_std:literal,)?
800-
$extra_deps:block;)+) => {
797+
stable = $stable:expr
798+
$(,tool_std = $tool_std:literal)?
799+
;)+) => {
801800
$(
802801
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
803802
pub struct $name {
@@ -839,7 +838,6 @@ macro_rules! tool_extended {
839838

840839
#[allow(unused_mut)]
841840
fn run(mut $sel, $builder: &Builder<'_>) -> Option<PathBuf> {
842-
$extra_deps
843841
$builder.ensure(ToolBuild {
844842
compiler: $sel.compiler,
845843
target: $sel.target,
@@ -848,11 +846,7 @@ macro_rules! tool_extended {
848846
path: $path,
849847
extra_features: $sel.extra_features,
850848
is_optional_tool: true,
851-
source_type: if false $(|| $in_tree)* {
852-
SourceType::InTree
853-
} else {
854-
SourceType::Submodule
855-
},
849+
source_type: SourceType::InTree,
856850
})
857851
}
858852
}
@@ -865,17 +859,17 @@ macro_rules! tool_extended {
865859
// Note: Most submodule updates for tools are handled by bootstrap.py, since they're needed just to
866860
// invoke Cargo to build bootstrap. See the comment there for more details.
867861
tool_extended!((self, builder),
868-
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true, in_tree=true, {};
869-
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true, in_tree=true, {};
870-
Clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {};
871-
Miri, "src/tools/miri", "miri", stable=false, in_tree=true, {};
872-
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, in_tree=true, {};
862+
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true;
863+
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true;
864+
Clippy, "src/tools/clippy", "clippy-driver", stable=true;
865+
Miri, "src/tools/miri", "miri", stable=false;
866+
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=true;
873867
// FIXME: tool_std is not quite right, we shouldn't allow nightly features.
874868
// But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0,
875869
// and this is close enough for now.
876-
Rls, "src/tools/rls", "rls", stable=true, in_tree=true, tool_std=true, {};
877-
RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, tool_std=true, {};
878-
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {};
870+
Rls, "src/tools/rls", "rls", stable=true, tool_std=true;
871+
RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, tool_std=true;
872+
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true;
879873
);
880874

881875
impl<'a> Builder<'a> {

src/tools/miri/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
clippy::cast_lossless,
3939
clippy::cast_possible_truncation,
4040
)]
41+
// Needed for rustdoc from bootstrap (with `-Znormalize-docs`).
42+
#![recursion_limit = "256"]
4143

4244
extern crate rustc_apfloat;
4345
extern crate rustc_ast;

0 commit comments

Comments
 (0)