Skip to content

bootstrap: Store and use an explicit CheckKind in check::Rustc - #160606

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:check-kind
Aug 8, 2026
Merged

bootstrap: Store and use an explicit CheckKind in check::Rustc#160606
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:check-kind

Conversation

@Zalathar

@Zalathar Zalathar commented Aug 6, 2026

Copy link
Copy Markdown
Member

#160417 tried to fix ./x fix compiler by making the check::Rustc step properly use builder.kind instead of hardcoding Kind::Check.

However, that ended up breaking ./x clippy, which was relying on that hardcoded Kind::Check to really invoke cargo check.

This PR therefore adds an explicit CheckKind to individual instances of check::Rustc, allowing command-line invocations to perform a cargo check or cargo fix as appropriate, without breaking other callers that were relying on the hardcoded cargo check.

As a result, ./x fix compiler now works.

r? Kobzol (or bootstrap)

These extra layers of indirection are more confusing than helpful.
@rustbot rustbot added 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 Aug 6, 2026
@rustbot

rustbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Kobzol is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Aug 6, 2026

Copy link
Copy Markdown
Member

Thanks! The last commit looks good.

I'm a bit wondering about 938bf98 though. I spent a lot of time last year ensuring that our usage of the various check/build/etc. steps is correct. It is very easy to pass the wrong thing to steps like check::Rustc. In this case, there is at least a specific type (CompilerForCheck), which makes it a bit harder to pass something completely unrelated. But that compiler still has to be prepared with the right target and mode. I'd like to leave at least the new function, to have a canonical way of constructing that step, if it was used on other places in the future.

That being said, there is only one usage of that function today, and it is close to where ;new` was, so probably it's fine to remove it. I just want to avoid ad-hoc construction of complicated steps (which this one is, because its fields have non-trivial pre-requisites) across bootstrap, and having a dedicated constructor helps with that.

This has the pleasant side-effect of making `./x fix compiler` actually work,
without breaking `./x clippy` (which relied on the hardcoded `Kind::Check`).
@Zalathar

Zalathar commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

In this particular case, I found it weird that the only user of the “real” constructor was the step's own make_run, and that the only other constructor would just bypass everything and forward directly to the fields anyway.

I have pushed a proposed change (diff) that makes PrepareRustcRmetaSysroot call a helper method instead of creating check::Rustc directly, so that all creations are close to Rustc in the source file.

@Kobzol

Kobzol commented Aug 6, 2026

Copy link
Copy Markdown
Member

In this particular case, I found it weird that the only user of the “real” constructor was the step's own make_run, and that the only other constructor would just bypass everything and forward directly to the fields anyway.

Yeah, the second constructor needs to bypass, because it is essentially "internal" usage of the step. The new function is used for normal usage where you just want to do all the necessary steps to make the step work. And yes, there was only one usage, but I still created a bunch of new constructors to keep a way to create similar steps correctly in the future.

I still think that the new function could be there, for consistency and to have a canonical way of constructing the step, but no strong opinions on it for this step.

Feel free to r=me after CI passes with/without adding the constructor back.

@Zalathar

Zalathar commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@bors r=Kobzol

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b344260 has been approved by Kobzol

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Aug 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 6, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
Rollup of 14 pull requests

Successful merges:

 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160634 (miri subtree update)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
bootstrap: Store and use an explicit CheckKind in `check::Rustc`

rust-lang#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
rust-bors Bot pushed a commit that referenced this pull request Aug 7, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - #159784 (Hint that memchr returns an in-bounds index)
 - #160673 (Improve `canonical_param_env_cache`)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160683 (Add regression test for unknown feaeture name reported with other errors)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
 - #160672 (Improve `MaybeLiveLocals`)
 - #160693 (Add branch config for perf. unrolling in bors)
 - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - #160706 (renovate: clarify that vulnerability PRs are opened automatically)
@rust-bors
rust-bors Bot merged commit 1dec347 into rust-lang:main Aug 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 8, 2026
rust-timer added a commit that referenced this pull request Aug 8, 2026
Rollup merge of #160606 - Zalathar:check-kind, r=Kobzol

bootstrap: Store and use an explicit CheckKind in `check::Rustc`

#160417 tried to fix `./x fix compiler` by making the `check::Rustc` step properly use `builder.kind` instead of hardcoding `Kind::Check`.

However, that ended up breaking `./x clippy`, which was relying on that hardcoded `Kind::Check` to really invoke `cargo check`.

This PR therefore adds an explicit CheckKind to individual instances of `check::Rustc`, allowing command-line invocations to perform a `cargo check` or `cargo fix` as appropriate, without breaking other callers that were relying on the hardcoded `cargo check`.

As a result, `./x fix compiler` now works.

r? Kobzol (or bootstrap)
@Zalathar
Zalathar deleted the check-kind branch August 8, 2026 02:28
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Aug 8, 2026
…uwer

Rollup of 28 pull requests

Successful merges:

 - rust-lang/rust#159784 (Hint that memchr returns an in-bounds index)
 - rust-lang/rust#160673 (Improve `canonical_param_env_cache`)
 - rust-lang/rust#150885 (Revive L4Re target)
 - rust-lang/rust#159643 (Add support for splatted function pointers)
 - rust-lang/rust#160433 (delegation: add support for wrapping of the return value with `From::from`)
 - rust-lang/rust#160530 (refactor handling of target features in Session)
 - rust-lang/rust#160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - rust-lang/rust#160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - rust-lang/rust#160683 (Add regression test for unknown feaeture name reported with other errors)
 - rust-lang/rust#157641 (Do not promote extern statics)
 - rust-lang/rust#158904 (Fix FutureDropPoll shim for by-move async closures)
 - rust-lang/rust#159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - rust-lang/rust#160103 (Add regression test for GAT bound mismatched type error)
 - rust-lang/rust#160335 (dlopen offload)
 - rust-lang/rust#160445 (codegen: classify localized MSVC linker progress as linker_info)
 - rust-lang/rust#160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - rust-lang/rust#160504 (cleanup borrowck, improve c-variadic handling)
 - rust-lang/rust#160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - rust-lang/rust#160587 (Add regression test for associated type outlives bound at call site)
 - rust-lang/rust#160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - rust-lang/rust#160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - rust-lang/rust#160636 (derive(Diagnostic): link to proper docs)
 - rust-lang/rust#160644 (Clean up some manual debug impls)
 - rust-lang/rust#160649 (move naked function ui tests)
 - rust-lang/rust#160672 (Improve `MaybeLiveLocals`)
 - rust-lang/rust#160693 (Add branch config for perf. unrolling in bors)
 - rust-lang/rust#160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - rust-lang/rust#160706 (renovate: clarify that vulnerability PRs are opened automatically)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants