Skip to content

Commit 3e765a7

Browse files
committed
Switch Steps from crates to crate_or_deps where possible
and document why the single remaining place can't switch
1 parent 58e18dd commit 3e765a7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/bootstrap/builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ impl<'a> ShouldRun<'a> {
442442
/// Indicates it should run if the command-line selects any of the given crates.
443443
///
444444
/// `make_run` will be called a single time with all matching command-line paths.
445+
///
446+
/// Prefer [`ShouldRun::crate_or_deps`] to this function where possible.
445447
pub(crate) fn crates(mut self, crates: Vec<&Crate>) -> Self {
446448
for krate in crates {
447449
let path = krate.local_path(self.builder);

src/bootstrap/check.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ impl Step for Std {
8585
const DEFAULT: bool = true;
8686

8787
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
88-
let crates = run.builder.in_tree_crates("sysroot", None);
89-
run.crates(crates).path("library")
88+
run.crate_or_deps("sysroot").path("library")
9089
}
9190

9291
fn make_run(run: RunConfig<'_>) {
@@ -215,8 +214,7 @@ impl Step for Rustc {
215214
const DEFAULT: bool = true;
216215

217216
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
218-
let crates = run.builder.in_tree_crates("rustc-main", None);
219-
run.crates(crates).path("compiler")
217+
run.crate_or_deps("rustc-main").path("compiler")
220218
}
221219

222220
fn make_run(run: RunConfig<'_>) {

src/bootstrap/compile.rs

+2
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ impl Step for Rustc {
620620
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
621621
let mut crates = run.builder.in_tree_crates("rustc-main", None);
622622
for (i, krate) in crates.iter().enumerate() {
623+
// We can't allow `build rustc` as an alias for this Step, because that's reserved by `Assemble`.
624+
// Ideally Assemble would use `build compiler` instead, but that seems too confusing to be worth the breaking change.
623625
if krate.name == "rustc-main" {
624626
crates.swap_remove(i);
625627
break;

0 commit comments

Comments
 (0)