Skip to content

Conversation

@Zalathar
Copy link
Member

One of the confusing things about bootstrap's Step::should_run is that it combines two loosely-related but non-overlapping responsibilities:

  • Registering paths/aliases to decide whether a step should be run in response to paths/aliases passed as explicit command-line arguments
    • When the user invokes ./x test compiler, this allows bootstrap to know what steps “compiler” should translate into
  • Deciding whether a step marked DEFAULT = true should actually run or not, when no paths/aliases are explicitly specified
    • When the user invokes ./x test, this allows bootstrap to know which steps to run by default

This PR splits out the latter of those responsibilities into a separate is_really_default associated function.

A small number of steps were using ShouldRun::lazy_default_condition to specify a condition that should not be run repeatedly if possible, e.g. because it queries external tools. Those steps now perform memoization via fields in Builder instead.

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2025

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@jieyouxu jieyouxu self-assigned this Nov 15, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a big fan of the changes, I think this is much less confusing than before. However, I would like to discuss the name of is_really_default with the team, because I still find it confusing to read...

View changes since this review

// named `builder` for IDE autocompletion.
let _ = builder;
Self::DEFAULT
}
Copy link
Member

@jieyouxu jieyouxu Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: maybe a name like finalized_default? I kinda hate that name too, it reminds me of the convoluted compiler lint level decoration logic... Anyway, 'finalized' in the sense that there's a hierarchy or precedence ordering:

  1. Step::DEFAULT is the "base" default.
  2. is_really_default or finalized_default can "override" this base default subject to conditions.

(2) then finally determines if a Step is eligible to run.

I say this because is_really_default I find quite confusing to read...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think is_really_default is a great name, but on the other hand I do appreciate that it conveys a suitable amount of “you should probably read the actual docs for this oddly-named function instead of assuming that it does something intuitive”.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... Yeah. Let's land this now as is_really_default, if we can come up with a better name later, we can always do that in a follow-up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to merge const DEFAULT and fn is_really_default into a single fn default that returns a constant value for most steps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah. I think I like that better.

Comment on lines +156 to +157
/// Called to allow steps to register the command-line paths that should
/// cause them to run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion:

command-line paths

I guess this is a path / path filter. Discussing in #t-infra/bootstrap > Path filters in bootstrap @ 💬 on what we actually call these

./x test xxx
         ^-- what is this called?

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 15, 2025

📌 Commit b9b6b58 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2025
@jieyouxu
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 15, 2025
@jieyouxu
Copy link
Member

#148965 (comment), but also doesn't necessarily need to be in this PR, at your discretion.

@rustbot
Copy link
Collaborator

rustbot commented Nov 16, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Zalathar
Copy link
Member Author

The additional changes for is_default_step were substantial enough that I've opened a separate PR to potentially replace this one:

@Zalathar Zalathar marked this pull request as draft November 16, 2025 03:22
@bors
Copy link
Collaborator

bors commented Nov 17, 2025

☔ The latest upstream changes (presumably #148763) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants