Skip to content

Commit 10326d8

Browse files
committed
Auto merge of #73232 - RalfJung:miri-no-default, r=Mark-Simulacrum
x.py: do not build Miri by default on stable/beta Fixes #73117 Do I need to do anything to make sure Miri is still built by the tools CI builder? Are there other tools that should be off-by-default? Also, unfortunately the `DEFAULT` associated const has no doc comment, so I have no idea what it does, or why there are semmingly two places where the default build of tools is controlled.
2 parents d3d3a14 + 416b010 commit 10326d8

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

src/bootstrap/builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
5252
/// it's been assembled.
5353
type Output: Clone;
5454

55+
/// Whether this step is run by default as part of its respective phase.
56+
/// `true` here can still be overwritten by `should_run` calling `default_condition`.
5557
const DEFAULT: bool = false;
5658

5759
/// If true, then this rule should be skipped if --target was specified, but --host was not

src/bootstrap/tool.rs

+18-12
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ macro_rules! tool_extended {
595595
$toolstate:ident,
596596
$path:expr,
597597
$tool_name:expr,
598+
stable = $stable:expr,
598599
$extra_deps:block;)+) => {
599600
$(
600601
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -606,17 +607,22 @@ macro_rules! tool_extended {
606607

607608
impl Step for $name {
608609
type Output = Option<PathBuf>;
609-
const DEFAULT: bool = true;
610+
const DEFAULT: bool = true; // Overwritten below
610611
const ONLY_HOSTS: bool = true;
611612

612613
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
613614
let builder = run.builder;
614615
run.path($path).default_condition(
615616
builder.config.extended
616-
&& builder.config.tools.as_ref().map_or(true, |tools| {
617-
tools.iter().any(|tool| match tool.as_ref() {
618-
"clippy" => $tool_name == "clippy-driver",
619-
x => $tool_name == x,
617+
&& builder.config.tools.as_ref().map_or(
618+
// By default, on nightly/dev enable all tools, else only
619+
// build stable tools.
620+
$stable || builder.build.unstable_features(),
621+
// If `tools` is set, search list for this tool.
622+
|tools| {
623+
tools.iter().any(|tool| match tool.as_ref() {
624+
"clippy" => $tool_name == "clippy-driver",
625+
x => $tool_name == x,
620626
})
621627
}),
622628
)
@@ -652,20 +658,20 @@ macro_rules! tool_extended {
652658
// Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
653659
// to make `./x.py build <tool>` work.
654660
tool_extended!((self, builder),
655-
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
656-
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
657-
Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
658-
Miri, miri, "src/tools/miri", "miri", {};
659-
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
660-
Rls, rls, "src/tools/rls", "rls", {
661+
Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
662+
CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
663+
Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
664+
Miri, miri, "src/tools/miri", "miri", stable=false, {};
665+
CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
666+
Rls, rls, "src/tools/rls", "rls", stable=true, {
661667
builder.ensure(Clippy {
662668
compiler: self.compiler,
663669
target: self.target,
664670
extra_features: Vec::new(),
665671
});
666672
self.extra_features.push("clippy".to_owned());
667673
};
668-
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
674+
Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
669675
);
670676

671677
impl<'a> Builder<'a> {

0 commit comments

Comments
 (0)