-(rebased to 1.44.1)
-From 416b010f4087d055febe2d55919f74e261ca8cd6 Mon Sep 17 00:00:00 2001
-From: Ralf Jung <post@ralfj.de>
-Date: Thu, 11 Jun 2020 09:25:06 +0200
-Subject: [PATCH] x.py: do not build Miri by default
-
----
- src/bootstrap/builder.rs | 2 ++
- src/bootstrap/tool.rs | 30 ++++++++++++++++++------------
- 2 files changed, 20 insertions(+), 12 deletions(-)
-
-diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
-index ffdd8485181f4..c4f29927cf4a8 100644
---- a/src/bootstrap/builder.rs
-+++ b/src/bootstrap/builder.rs
-@@ -52,6 +52,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
- /// it's been assembled.
- type Output: Clone;
-
-+ /// Whether this step is run by default as part of its respective phase.
-+ /// `true` here can still be overwritten by `should_run` calling `default_condition`.
- const DEFAULT: bool = false;
-
- /// If true, then this rule should be skipped if --target was specified, but --host was not
-diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
-index 6cd9f9029c948..9c95de0a81eae 100644
---- a/src/bootstrap/tool.rs
-+++ b/src/bootstrap/tool.rs
-@@ -591,6 +591,7 @@ macro_rules! tool_extended {
- $toolstate:ident,
- $path:expr,
- $tool_name:expr,
-+ stable = $stable:expr,
- $extra_deps:block;)+) => {
- $(
- #[derive(Debug, Clone, Hash, PartialEq, Eq)]
-@@ -602,17 +603,22 @@ macro_rules! tool_extended {
-
- impl Step for $name {
- type Output = Option<PathBuf>;
-- const DEFAULT: bool = true;
-+ const DEFAULT: bool = true; // Overwritten below
- const ONLY_HOSTS: bool = true;
-
- fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- let builder = run.builder;
- run.path($path).default_condition(
- builder.config.extended
-- && builder.config.tools.as_ref().map_or(true, |tools| {
-- tools.iter().any(|tool| match tool.as_ref() {
-- "clippy" => $tool_name == "clippy-driver",
-- x => $tool_name == x,
-+ && builder.config.tools.as_ref().map_or(
-+ // By default, on nightly/dev enable all tools, else only
-+ // build stable tools.
-+ $stable || builder.build.unstable_features(),
-+ // If `tools` is set, search list for this tool.
-+ |tools| {
-+ tools.iter().any(|tool| match tool.as_ref() {
-+ "clippy" => $tool_name == "clippy-driver",
-+ x => $tool_name == x,
- })
- }),
- )
-@@ -646,12 +652,12 @@ macro_rules! tool_extended {
- }
-
- tool_extended!((self, builder),
-- Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
-- CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
-- Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
-- Miri, miri, "src/tools/miri", "miri", {};
-- CargoMiri, miri, "src/tools/miri", "cargo-miri", {};
-- Rls, rls, "src/tools/rls", "rls", {
-+ Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
-+ CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
-+ Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
-+ Miri, miri, "src/tools/miri", "miri", stable=false, {};
-+ CargoMiri, miri, "src/tools/miri", "cargo-miri", stable=false, {};
-+ Rls, rls, "src/tools/rls", "rls", stable=true, {
- let clippy = builder.ensure(Clippy {
- compiler: self.compiler,
- target: self.target,
-@@ -661,7 +667,7 @@ tool_extended!((self, builder),
- self.extra_features.push("clippy".to_owned());
- }
- };
-- Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
-+ Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
- );
-
- impl<'a> Builder<'a> {