diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index c28fe4ad832d3..37a6398925b7c 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -904,6 +904,54 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the } } +/// Runs `library/stdarch/crates/stdarch-verify`'s tests which cross-check the +/// `core::arch` intrinsics for x86, Arm, and MIPS against the corresponding +/// vendor references (signatures, target features, and `assert_instr` mappings). +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct StdarchVerify; + +impl Step for StdarchVerify { + type Output = (); + const IS_HOST: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("library/stdarch/crates/stdarch-verify") + } + + fn is_default_step(_builder: &Builder<'_>) -> bool { + true + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(StdarchVerify); + } + + fn run(self, builder: &Builder<'_>) { + let host = builder.config.host_target; + let build_compiler = builder.compiler(0, host); + + let cargo = tool::prepare_tool_cargo( + builder, + build_compiler, + Mode::ToolBootstrap, + host, + Kind::Test, + "library/stdarch/crates/stdarch-verify", + SourceType::InTree, + &[], + ); + + run_cargo_test( + cargo, + &[], + &["stdarch-verify".to_string()], + Some("stdarch-verify"), + host, + builder, + ); + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Clippy { compilers: RustcPrivateCompilers, diff --git a/src/bootstrap/src/core/build_steps/vendor.rs b/src/bootstrap/src/core/build_steps/vendor.rs index 17bee20a525b6..519f134bb8203 100644 --- a/src/bootstrap/src/core/build_steps/vendor.rs +++ b/src/bootstrap/src/core/build_steps/vendor.rs @@ -24,6 +24,7 @@ pub fn default_paths_to_vendor(builder: &Builder<'_>) -> Vec<(PathBuf, Vec<&'sta ("compiler/rustc_codegen_cranelift/Cargo.toml", vec![]), ("compiler/rustc_codegen_gcc/Cargo.toml", vec![]), ("library/Cargo.toml", vec![]), + ("library/stdarch/Cargo.toml", vec![]), ("src/bootstrap/Cargo.toml", vec![]), ("src/tools/rustbook/Cargo.toml", SUBMODULES_FOR_RUSTBOOK.into()), ("src/tools/rustc-perf/Cargo.toml", vec!["src/tools/rustc-perf"]), diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap index 25ff1e64e76b4..60e8a219585c6 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test.snap @@ -181,6 +181,9 @@ expression: test [Test] test::RustcBook targets: [x86_64-unknown-linux-gnu] - Set({test::src/doc/rustc}) +[Test] test::StdarchVerify + targets: [x86_64-unknown-linux-gnu] + - Set({test::library/stdarch/crates/stdarch-verify}) [Test] test::RustdocJSStd targets: [x86_64-unknown-linux-gnu] - Suite(test::tests/rustdoc-js-std) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_library.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_library.snap index dfc397597a877..f97bb839c1e73 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_library.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_library.snap @@ -18,3 +18,6 @@ expression: test library - Set({test::library/sysroot}) - Set({test::library/test}) - Set({test::library/unwind}) +[Test] test::StdarchVerify + targets: [x86_64-unknown-linux-gnu] + - Set({test::library/stdarch/crates/stdarch-verify}) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap index 2f1ee9386ed72..fb83986445bea 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_coverage.snap @@ -180,6 +180,9 @@ expression: test --skip=coverage [Test] test::RustcBook targets: [x86_64-unknown-linux-gnu] - Set({test::src/doc/rustc}) +[Test] test::StdarchVerify + targets: [x86_64-unknown-linux-gnu] + - Set({test::library/stdarch/crates/stdarch-verify}) [Test] test::RustdocJSStd targets: [x86_64-unknown-linux-gnu] - Suite(test::tests/rustdoc-js-std) diff --git a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap index 8f5e842d28a15..3737272dd83a4 100644 --- a/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap +++ b/src/bootstrap/src/core/builder/cli_paths/snapshots/x_test_skip_tests.snap @@ -144,6 +144,9 @@ expression: test --skip=tests [Test] test::RustcBook targets: [x86_64-unknown-linux-gnu] - Set({test::src/doc/rustc}) +[Test] test::StdarchVerify + targets: [x86_64-unknown-linux-gnu] + - Set({test::library/stdarch/crates/stdarch-verify}) [Test] test::RustdocTheme targets: [x86_64-unknown-linux-gnu] - Set({test::src/tools/rustdoc-themes}) diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index bc402313367fd..2e640220efd8e 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -910,6 +910,7 @@ impl<'a> Builder<'a> { test::CargoMiri, test::Clippy, test::CompiletestTest, + test::StdarchVerify, test::CrateRunMakeSupport, test::CrateBuildHelper, test::RustdocJSStd, diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 2b12e653f3748..ef08286122916 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -132,6 +132,12 @@ pub(crate) const WORKSPACES: &[WorkspaceInfo<'static>] = &[ )), submodules: &[], }, + WorkspaceInfo { + path: "library/stdarch", + exceptions: EXCEPTIONS_STDARCH, + crates_and_deps: None, + submodules: &[], + }, WorkspaceInfo { path: "compiler/rustc_codegen_cranelift", exceptions: EXCEPTIONS_CRANELIFT, @@ -254,6 +260,8 @@ const EXCEPTIONS_RUSTBOOK: ExceptionList = &[ // tidy-alphabetical-end ]; +const EXCEPTIONS_STDARCH: ExceptionList = &[]; + const EXCEPTIONS_CRANELIFT: ExceptionList = &[]; const EXCEPTIONS_GCC: ExceptionList = &[