Skip to content

Commit 0227d8d

Browse files
committed
Enable x.py check for miri
1 parent 2b91cbe commit 0227d8d

File tree

4 files changed

+19
-49
lines changed

4 files changed

+19
-49
lines changed

src/bootstrap/check.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,12 @@ 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);
462460
tool_check_step!(Rls, "src/tools/rls", SourceType::InTree);
463461
tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree);
464462

src/bootstrap/doc.rs

+6-29
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ impl Step for Rustc {
734734
}
735735

736736
macro_rules! tool_doc {
737-
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => {
737+
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
738738
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
739739
pub struct $tool {
740740
target: TargetSelection,
@@ -790,12 +790,6 @@ macro_rules! tool_doc {
790790
t!(fs::create_dir_all(&out_dir));
791791
t!(symlink_dir_force(&builder.config, &out, &out_dir));
792792

793-
let source_type = if $in_tree == true {
794-
SourceType::InTree
795-
} else {
796-
SourceType::Submodule
797-
};
798-
799793
// Build cargo command.
800794
let mut cargo = prepare_tool_cargo(
801795
builder,
@@ -804,7 +798,7 @@ macro_rules! tool_doc {
804798
target,
805799
"doc",
806800
$path,
807-
source_type,
801+
SourceType::InTree,
808802
&[],
809803
);
810804

@@ -820,38 +814,21 @@ macro_rules! tool_doc {
820814
cargo.rustdocflag("--show-type-layout");
821815
cargo.rustdocflag("--generate-link-to-definition");
822816
cargo.rustdocflag("-Zunstable-options");
823-
if $in_tree == true {
824-
builder.run(&mut cargo.into());
825-
} else {
826-
// Allow out-of-tree docs to fail (since the tool might be in a broken state).
827-
if !builder.try_run(&mut cargo.into()) {
828-
builder.info(&format!(
829-
"WARNING: tool {} failed to document; ignoring failure because it is an out-of-tree tool",
830-
stringify!($tool).to_lowercase(),
831-
));
832-
}
833-
}
817+
builder.run(&mut cargo.into());
834818
}
835819
}
836820
}
837821
}
838822

839-
tool_doc!(
840-
Rustdoc,
841-
"rustdoc-tool",
842-
"src/tools/rustdoc",
843-
["rustdoc", "rustdoc-json-types"],
844-
in_tree = true
845-
);
823+
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"],);
846824
tool_doc!(
847825
Rustfmt,
848826
"rustfmt-nightly",
849827
"src/tools/rustfmt",
850828
["rustfmt-nightly", "rustfmt-config_proc_macro"],
851-
in_tree = true
852829
);
853-
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true);
854-
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false);
830+
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
831+
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]);
855832

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

src/bootstrap/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ impl Step for Miri {
503503
host,
504504
"run",
505505
"src/tools/miri/cargo-miri",
506-
SourceType::Submodule,
506+
SourceType::InTree,
507507
&[],
508508
);
509509
cargo.add_rustc_lib_path(builder, compiler);
@@ -550,7 +550,7 @@ impl Step for Miri {
550550
host,
551551
"test",
552552
"src/tools/miri",
553-
SourceType::Submodule,
553+
SourceType::InTree,
554554
&[],
555555
);
556556
cargo.add_rustc_lib_path(builder, compiler);

src/bootstrap/tool.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ macro_rules! tool_extended {
795795
$path:expr,
796796
$tool_name:expr,
797797
stable = $stable:expr,
798-
$(in_tree = $in_tree:expr,)?
799798
$(tool_std = $tool_std:literal,)?
800799
$extra_deps:block;)+) => {
801800
$(
@@ -848,11 +847,7 @@ macro_rules! tool_extended {
848847
path: $path,
849848
extra_features: $sel.extra_features,
850849
is_optional_tool: true,
851-
source_type: if false $(|| $in_tree)* {
852-
SourceType::InTree
853-
} else {
854-
SourceType::Submodule
855-
},
850+
source_type: SourceType::InTree,
856851
})
857852
}
858853
}
@@ -865,17 +860,17 @@ macro_rules! tool_extended {
865860
// Note: Most submodule updates for tools are handled by bootstrap.py, since they're needed just to
866861
// invoke Cargo to build bootstrap. See the comment there for more details.
867862
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, {};
863+
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
864+
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
865+
Clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
866+
Miri, "src/tools/miri", "miri", stable=false, {};
867+
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=true, {};
873868
// FIXME: tool_std is not quite right, we shouldn't allow nightly features.
874869
// But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0,
875870
// 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, {};
871+
Rls, "src/tools/rls", "rls", stable=true, tool_std=true, {};
872+
RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, tool_std=true, {};
873+
Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
879874
);
880875

881876
impl<'a> Builder<'a> {

0 commit comments

Comments
 (0)