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 therefore splits out the latter of those responsibilities into a dedicated is_default_step associated function, which also replaces the existing DEFAULT associated constant.

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.

r? jieyouxu

@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 16, 2025
@Zalathar
Copy link
Member Author

Ignoring the new snapshot tests, the actual git diff --shortstat is more like +511, -307.

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-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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants