Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 29abb90

Browse files
committedDec 29, 2023
Auto merge of #119373 - Kobzol:missing-tools-bootstrap, r=onur-ozkan
Remove usage of deprecated `missing-tools` bootstrap flag This PR removes the usage of `--enable-missing-tools` in CI, as this config option is no longer used. It also removes `dist.missing-tools` config completely. Let me know which commits should I remove (if any). Fixes: #79249 r? `@onur-ozkan`
2 parents dc450f9 + fdeb8c5 commit 29abb90

File tree

9 files changed

+98
-134
lines changed

9 files changed

+98
-134
lines changed
 

‎src/bootstrap/configure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def v(*args):
5555
o("full-tools", None, "enable all tools")
5656
o("lld", "rust.lld", "build lld")
5757
o("clang", "llvm.clang", "build clang")
58-
o("missing-tools", "dist.missing-tools", "allow failures when building tools")
5958
o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++")
6059
o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard")
6160
o("patch-binaries-for-nix", "build.patch-binaries-for-nix", "whether patch binaries for usage with Nix toolchains")

‎src/bootstrap/src/core/build_steps/dist.rs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,7 @@ impl Step for Rls {
11101110
let compiler = self.compiler;
11111111
let target = self.target;
11121112

1113-
let rls = builder
1114-
.ensure(tool::Rls { compiler, target, extra_features: Vec::new() })
1115-
.expect("rls expected to build");
1113+
let rls = builder.ensure(tool::Rls { compiler, target, extra_features: Vec::new() });
11161114

11171115
let mut tarball = Tarball::new(builder, "rls", &target.triple);
11181116
tarball.set_overlay(OverlayKind::RLS);
@@ -1154,9 +1152,7 @@ impl Step for RustAnalyzer {
11541152
let compiler = self.compiler;
11551153
let target = self.target;
11561154

1157-
let rust_analyzer = builder
1158-
.ensure(tool::RustAnalyzer { compiler, target })
1159-
.expect("rust-analyzer always builds");
1155+
let rust_analyzer = builder.ensure(tool::RustAnalyzer { compiler, target });
11601156

11611157
let mut tarball = Tarball::new(builder, "rust-analyzer", &target.triple);
11621158
tarball.set_overlay(OverlayKind::RustAnalyzer);
@@ -1201,12 +1197,9 @@ impl Step for Clippy {
12011197
// Prepare the image directory
12021198
// We expect clippy to build, because we've exited this step above if tool
12031199
// state for clippy isn't testing.
1204-
let clippy = builder
1205-
.ensure(tool::Clippy { compiler, target, extra_features: Vec::new() })
1206-
.expect("clippy expected to build - essential tool");
1207-
let cargoclippy = builder
1208-
.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() })
1209-
.expect("clippy expected to build - essential tool");
1200+
let clippy = builder.ensure(tool::Clippy { compiler, target, extra_features: Vec::new() });
1201+
let cargoclippy =
1202+
builder.ensure(tool::CargoClippy { compiler, target, extra_features: Vec::new() });
12101203

12111204
let mut tarball = Tarball::new(builder, "clippy", &target.triple);
12121205
tarball.set_overlay(OverlayKind::Clippy);
@@ -1255,9 +1248,9 @@ impl Step for Miri {
12551248
let compiler = self.compiler;
12561249
let target = self.target;
12571250

1258-
let miri = builder.ensure(tool::Miri { compiler, target, extra_features: Vec::new() })?;
1251+
let miri = builder.ensure(tool::Miri { compiler, target, extra_features: Vec::new() });
12591252
let cargomiri =
1260-
builder.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() })?;
1253+
builder.ensure(tool::CargoMiri { compiler, target, extra_features: Vec::new() });
12611254

12621255
let mut tarball = Tarball::new(builder, "miri", &target.triple);
12631256
tarball.set_overlay(OverlayKind::Miri);
@@ -1396,12 +1389,10 @@ impl Step for Rustfmt {
13961389
let compiler = self.compiler;
13971390
let target = self.target;
13981391

1399-
let rustfmt = builder
1400-
.ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() })
1401-
.expect("rustfmt expected to build - essential tool");
1402-
let cargofmt = builder
1403-
.ensure(tool::Cargofmt { compiler, target, extra_features: Vec::new() })
1404-
.expect("cargo fmt expected to build - essential tool");
1392+
let rustfmt =
1393+
builder.ensure(tool::Rustfmt { compiler, target, extra_features: Vec::new() });
1394+
let cargofmt =
1395+
builder.ensure(tool::Cargofmt { compiler, target, extra_features: Vec::new() });
14051396
let mut tarball = Tarball::new(builder, "rustfmt", &target.triple);
14061397
tarball.set_overlay(OverlayKind::Rustfmt);
14071398
tarball.is_preview(true);
@@ -1455,9 +1446,8 @@ impl Step for RustDemangler {
14551446
return None;
14561447
}
14571448

1458-
let rust_demangler = builder
1459-
.ensure(tool::RustDemangler { compiler, target, extra_features: Vec::new() })
1460-
.expect("rust-demangler expected to build - in-tree tool");
1449+
let rust_demangler =
1450+
builder.ensure(tool::RustDemangler { compiler, target, extra_features: Vec::new() });
14611451

14621452
// Prepare the image directory
14631453
let mut tarball = Tarball::new(builder, "rust-demangler", &target.triple);

‎src/bootstrap/src/core/build_steps/run.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ impl Step for Miri {
148148
let target = self.target;
149149
let compiler = builder.compiler(stage, host);
150150

151-
let miri = builder
152-
.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() })
153-
.expect("in-tree tool");
151+
let miri =
152+
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
154153
let miri_sysroot = test::Miri::build_miri_sysroot(builder, compiler, &miri, target);
155154

156155
// # Run miri.

‎src/bootstrap/src/core/build_steps/test.rs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,7 @@ impl Step for Rustfmt {
427427
let host = self.host;
428428
let compiler = builder.compiler(stage, host);
429429

430-
builder
431-
.ensure(tool::Rustfmt { compiler, target: self.host, extra_features: Vec::new() })
432-
.expect("in-tree tool");
430+
builder.ensure(tool::Rustfmt { compiler, target: self.host, extra_features: Vec::new() });
433431

434432
let mut cargo = tool::prepare_tool_cargo(
435433
builder,
@@ -476,9 +474,11 @@ impl Step for RustDemangler {
476474
let host = self.host;
477475
let compiler = builder.compiler(stage, host);
478476

479-
let rust_demangler = builder
480-
.ensure(tool::RustDemangler { compiler, target: self.host, extra_features: Vec::new() })
481-
.expect("in-tree tool");
477+
let rust_demangler = builder.ensure(tool::RustDemangler {
478+
compiler,
479+
target: self.host,
480+
extra_features: Vec::new(),
481+
});
482482
let mut cargo = tool::prepare_tool_cargo(
483483
builder,
484484
compiler,
@@ -609,12 +609,13 @@ impl Step for Miri {
609609
// Except if we are at stage 2, the bootstrap loop is complete and we can stick with our current stage.
610610
let compiler_std = builder.compiler(if stage < 2 { stage + 1 } else { stage }, host);
611611

612-
let miri = builder
613-
.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() })
614-
.expect("in-tree tool");
615-
let _cargo_miri = builder
616-
.ensure(tool::CargoMiri { compiler, target: self.host, extra_features: Vec::new() })
617-
.expect("in-tree tool");
612+
let miri =
613+
builder.ensure(tool::Miri { compiler, target: self.host, extra_features: Vec::new() });
614+
let _cargo_miri = builder.ensure(tool::CargoMiri {
615+
compiler,
616+
target: self.host,
617+
extra_features: Vec::new(),
618+
});
618619
// The stdlib we need might be at a different stage. And just asking for the
619620
// sysroot does not seem to populate it, so we do that first.
620621
builder.ensure(compile::Std::new(compiler_std, host));
@@ -788,9 +789,7 @@ impl Step for Clippy {
788789
let host = self.host;
789790
let compiler = builder.compiler(stage, host);
790791

791-
builder
792-
.ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() })
793-
.expect("in-tree tool");
792+
builder.ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() });
794793
let mut cargo = tool::prepare_tool_cargo(
795794
builder,
796795
compiler,
@@ -1668,13 +1667,11 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
16681667
if mode == "coverage-run" {
16691668
// The demangler doesn't need the current compiler, so we can avoid
16701669
// unnecessary rebuilds by using the bootstrap compiler instead.
1671-
let rust_demangler = builder
1672-
.ensure(tool::RustDemangler {
1673-
compiler: compiler.with_stage(0),
1674-
target: compiler.host,
1675-
extra_features: Vec::new(),
1676-
})
1677-
.expect("in-tree tool");
1670+
let rust_demangler = builder.ensure(tool::RustDemangler {
1671+
compiler: compiler.with_stage(0),
1672+
target: compiler.host,
1673+
extra_features: Vec::new(),
1674+
});
16781675
cmd.arg("--rust-demangler-path").arg(rust_demangler);
16791676
}
16801677

‎src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 57 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ struct ToolBuild {
2727
tool: &'static str,
2828
path: &'static str,
2929
mode: Mode,
30-
is_optional_tool: bool,
3130
source_type: SourceType,
3231
extra_features: Vec<String>,
3332
/// Nightly-only features that are allowed (comma-separated list).
@@ -60,7 +59,7 @@ impl Builder<'_> {
6059
}
6160

6261
impl Step for ToolBuild {
63-
type Output = Option<PathBuf>;
62+
type Output = PathBuf;
6463

6564
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
6665
run.never()
@@ -70,12 +69,11 @@ impl Step for ToolBuild {
7069
///
7170
/// This will build the specified tool with the specified `host` compiler in
7271
/// `stage` into the normal cargo output directory.
73-
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
72+
fn run(self, builder: &Builder<'_>) -> PathBuf {
7473
let compiler = self.compiler;
7574
let target = self.target;
7675
let mut tool = self.tool;
7776
let path = self.path;
78-
let is_optional_tool = self.is_optional_tool;
7977

8078
match self.mode {
8179
Mode::ToolRustc => {
@@ -109,20 +107,16 @@ impl Step for ToolBuild {
109107
);
110108

111109
let mut cargo = Command::from(cargo);
112-
// we check this in `is_optional_tool` in a second
113-
let is_expected = builder.run_cmd(BootstrapCommand::from(&mut cargo).allow_failure());
110+
// we check this below
111+
let build_success = builder.run_cmd(BootstrapCommand::from(&mut cargo).allow_failure());
114112

115113
builder.save_toolstate(
116114
tool,
117-
if is_expected { ToolState::TestFail } else { ToolState::BuildFail },
115+
if build_success { ToolState::TestFail } else { ToolState::BuildFail },
118116
);
119117

120-
if !is_expected {
121-
if !is_optional_tool {
122-
crate::exit!(1);
123-
} else {
124-
None
125-
}
118+
if !build_success {
119+
crate::exit!(1);
126120
} else {
127121
// HACK(#82501): on Windows, the tools directory gets added to PATH when running tests, and
128122
// compiletest confuses HTML tidy with the in-tree tidy. Name the in-tree tidy something
@@ -133,7 +127,7 @@ impl Step for ToolBuild {
133127
let cargo_out = builder.cargo_out(compiler, self.mode, target).join(exe(tool, target));
134128
let bin = builder.tools_dir(compiler).join(exe(tool, target));
135129
builder.copy(&cargo_out, &bin);
136-
Some(bin)
130+
bin
137131
}
138132
}
139133
}
@@ -278,15 +272,14 @@ macro_rules! bootstrap_tool {
278272
Mode::ToolBootstrap
279273
},
280274
path: $path,
281-
is_optional_tool: false,
282275
source_type: if false $(|| $external)* {
283276
SourceType::Submodule
284277
} else {
285278
SourceType::InTree
286279
},
287280
extra_features: vec![],
288281
allow_features: concat!($($allow_features)*),
289-
}).expect("expected to build -- essential tool")
282+
})
290283
}
291284
}
292285
)+
@@ -361,19 +354,16 @@ impl Step for ErrorIndex {
361354
}
362355

363356
fn run(self, builder: &Builder<'_>) -> PathBuf {
364-
builder
365-
.ensure(ToolBuild {
366-
compiler: self.compiler,
367-
target: self.compiler.host,
368-
tool: "error_index_generator",
369-
mode: Mode::ToolRustc,
370-
path: "src/tools/error_index_generator",
371-
is_optional_tool: false,
372-
source_type: SourceType::InTree,
373-
extra_features: Vec::new(),
374-
allow_features: "",
375-
})
376-
.expect("expected to build -- essential tool")
357+
builder.ensure(ToolBuild {
358+
compiler: self.compiler,
359+
target: self.compiler.host,
360+
tool: "error_index_generator",
361+
mode: Mode::ToolRustc,
362+
path: "src/tools/error_index_generator",
363+
source_type: SourceType::InTree,
364+
extra_features: Vec::new(),
365+
allow_features: "",
366+
})
377367
}
378368
}
379369

@@ -398,19 +388,16 @@ impl Step for RemoteTestServer {
398388
}
399389

400390
fn run(self, builder: &Builder<'_>) -> PathBuf {
401-
builder
402-
.ensure(ToolBuild {
403-
compiler: self.compiler,
404-
target: self.target,
405-
tool: "remote-test-server",
406-
mode: Mode::ToolStd,
407-
path: "src/tools/remote-test-server",
408-
is_optional_tool: false,
409-
source_type: SourceType::InTree,
410-
extra_features: Vec::new(),
411-
allow_features: "",
412-
})
413-
.expect("expected to build -- essential tool")
391+
builder.ensure(ToolBuild {
392+
compiler: self.compiler,
393+
target: self.target,
394+
tool: "remote-test-server",
395+
mode: Mode::ToolStd,
396+
path: "src/tools/remote-test-server",
397+
source_type: SourceType::InTree,
398+
extra_features: Vec::new(),
399+
allow_features: "",
400+
})
414401
}
415402
}
416403

@@ -557,19 +544,16 @@ impl Step for Cargo {
557544
}
558545

559546
fn run(self, builder: &Builder<'_>) -> PathBuf {
560-
let cargo_bin_path = builder
561-
.ensure(ToolBuild {
562-
compiler: self.compiler,
563-
target: self.target,
564-
tool: "cargo",
565-
mode: Mode::ToolRustc,
566-
path: "src/tools/cargo",
567-
is_optional_tool: false,
568-
source_type: SourceType::Submodule,
569-
extra_features: Vec::new(),
570-
allow_features: "",
571-
})
572-
.expect("expected to build -- essential tool");
547+
let cargo_bin_path = builder.ensure(ToolBuild {
548+
compiler: self.compiler,
549+
target: self.target,
550+
tool: "cargo",
551+
mode: Mode::ToolRustc,
552+
path: "src/tools/cargo",
553+
source_type: SourceType::Submodule,
554+
extra_features: Vec::new(),
555+
allow_features: "",
556+
});
573557
cargo_bin_path
574558
}
575559
}
@@ -588,19 +572,16 @@ impl Step for LldWrapper {
588572
}
589573

590574
fn run(self, builder: &Builder<'_>) -> PathBuf {
591-
let src_exe = builder
592-
.ensure(ToolBuild {
593-
compiler: self.compiler,
594-
target: self.target,
595-
tool: "lld-wrapper",
596-
mode: Mode::ToolStd,
597-
path: "src/tools/lld-wrapper",
598-
is_optional_tool: false,
599-
source_type: SourceType::InTree,
600-
extra_features: Vec::new(),
601-
allow_features: "",
602-
})
603-
.expect("expected to build -- essential tool");
575+
let src_exe = builder.ensure(ToolBuild {
576+
compiler: self.compiler,
577+
target: self.target,
578+
tool: "lld-wrapper",
579+
mode: Mode::ToolStd,
580+
path: "src/tools/lld-wrapper",
581+
source_type: SourceType::InTree,
582+
extra_features: Vec::new(),
583+
allow_features: "",
584+
});
604585

605586
src_exe
606587
}
@@ -617,7 +598,7 @@ impl RustAnalyzer {
617598
}
618599

619600
impl Step for RustAnalyzer {
620-
type Output = Option<PathBuf>;
601+
type Output = PathBuf;
621602
const DEFAULT: bool = true;
622603
const ONLY_HOSTS: bool = true;
623604

@@ -640,15 +621,14 @@ impl Step for RustAnalyzer {
640621
});
641622
}
642623

643-
fn run(self, builder: &Builder<'_>) -> Option<PathBuf> {
624+
fn run(self, builder: &Builder<'_>) -> PathBuf {
644625
builder.ensure(ToolBuild {
645626
compiler: self.compiler,
646627
target: self.target,
647628
tool: "rust-analyzer",
648629
mode: Mode::ToolRustc,
649630
path: "src/tools/rust-analyzer",
650631
extra_features: vec!["rust-analyzer/in-rust-tree".to_owned()],
651-
is_optional_tool: false,
652632
source_type: SourceType::InTree,
653633
allow_features: RustAnalyzer::ALLOW_FEATURES,
654634
})
@@ -696,10 +676,9 @@ impl Step for RustAnalyzerProcMacroSrv {
696676
mode: Mode::ToolStd,
697677
path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli",
698678
extra_features: vec!["sysroot-abi".to_owned()],
699-
is_optional_tool: false,
700679
source_type: SourceType::InTree,
701680
allow_features: RustAnalyzer::ALLOW_FEATURES,
702-
})?;
681+
});
703682

704683
// Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/`
705684
// so that r-a can use it.
@@ -730,7 +709,7 @@ macro_rules! tool_extended {
730709
}
731710

732711
impl Step for $name {
733-
type Output = Option<PathBuf>;
712+
type Output = PathBuf;
734713
const DEFAULT: bool = true; // Overwritten below
735714
const ONLY_HOSTS: bool = true;
736715

@@ -761,18 +740,17 @@ macro_rules! tool_extended {
761740
}
762741

763742
#[allow(unused_mut)]
764-
fn run(mut $sel, $builder: &Builder<'_>) -> Option<PathBuf> {
743+
fn run(mut $sel, $builder: &Builder<'_>) -> PathBuf {
765744
let tool = $builder.ensure(ToolBuild {
766745
compiler: $sel.compiler,
767746
target: $sel.target,
768747
tool: $tool_name,
769748
mode: if false $(|| $tool_std)? { Mode::ToolStd } else { Mode::ToolRustc },
770749
path: $path,
771750
extra_features: $sel.extra_features,
772-
is_optional_tool: true,
773751
source_type: SourceType::InTree,
774752
allow_features: concat!($($allow_features)*),
775-
})?;
753+
});
776754

777755
if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 {
778756
let bindir = $builder.sysroot($sel.compiler).join("bin");
@@ -789,9 +767,9 @@ macro_rules! tool_extended {
789767
})?
790768

791769
let tool = bindir.join(exe($tool_name, $sel.compiler.host));
792-
Some(tool)
770+
tool
793771
} else {
794-
Some(tool)
772+
tool
795773
}
796774
}
797775
}

‎src/bootstrap/src/core/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ impl<'a> Builder<'a> {
11981198
let mut dylib_path = helpers::dylib_path();
11991199
dylib_path.insert(0, self.sysroot(run_compiler).join("lib"));
12001200

1201-
let mut cmd = Command::new(cargo_clippy.unwrap());
1201+
let mut cmd = Command::new(cargo_clippy);
12021202
cmd.env(helpers::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
12031203
cmd.env("PATH", path);
12041204
cmd

‎src/bootstrap/src/core/config/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub struct Config {
305305
pub save_toolstates: Option<PathBuf>,
306306
pub print_step_timings: bool,
307307
pub print_step_rusage: bool,
308-
pub missing_tools: bool,
308+
pub missing_tools: bool, // FIXME: Deprecated field. Remove it at 2024.
309309

310310
// Fallback musl-root for all targets
311311
pub musl_root: Option<PathBuf>,

‎src/bootstrap/src/utils/change_tracker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
101101
severity: ChangeSeverity::Warning,
102102
summary: "rust-analyzer-proc-macro-srv is no longer enabled by default. To build it, you must either enable it in the configuration or explicitly invoke it with x.py.",
103103
},
104+
ChangeInfo {
105+
change_id: 119373,
106+
severity: ChangeSeverity::Info,
107+
summary: "The dist.missing-tools config option was deprecated, as it was unused. If you are using it, remove it from your config, it will be removed soon.",
108+
},
104109
];

‎src/ci/run.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ else
153153
fi
154154
fi
155155

156-
if [ "$RUST_RELEASE_CHANNEL" = "nightly" ] || [ "$DIST_REQUIRE_ALL_TOOLS" = "" ]; then
157-
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-missing-tools"
158-
fi
159-
160156
# Unless we're using an older version of LLVM, check that all LLVM components
161157
# used by tests are available.
162158
if [ "$IS_NOT_LATEST_LLVM" = "" ]; then

0 commit comments

Comments
 (0)
Please sign in to comment.