Skip to content

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Dec 8, 2025

This gives better static checking when dealing with compiletest modes in bootstrap, especially for those modes that overlap with the name of a test suite directory.

r? jieyouxu (or bootstrap)

@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 Dec 8, 2025
@rust-log-analyzer

This comment has been minimized.

Comment on lines +6 to +8
// (This file should be split up, but having tidy block all changes is not helpful.)
// ignore-tidy-filelength

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 know why this file is suddenly failing tidy, when it has been well over 3000 lines for a long time.

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 guess it's counting non-blank non-comment lines, and this PR does push it slightly over 3000 of those, mostly due to formatting changes.

Copy link
Member

Choose a reason for hiding this comment

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

It's been just about 3000 lines yeah. I planned to break the test.rs source into a smaller modules, but haven't gotten around to figuring out a nicer structure.

Comment on lines +1932 to +1938
if matches!(
mode,
CompiletestMode::RunMake
| CompiletestMode::Rustdoc
| CompiletestMode::RustdocJs
| CompiletestMode::RustdocJson
) || matches!(suite, "rustdoc-ui" | "coverage-run-rustdoc")
Copy link
Member Author

Choose a reason for hiding this comment

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

Here I've replaced (mode == "ui" && is_rustdoc) with matches!(suite, "rustdoc-ui"), which has the same outcome but is more direct about what it's doing.

@rust-log-analyzer

This comment has been minimized.

@Zalathar
Copy link
Member Author

Zalathar commented Dec 8, 2025

Ugh, build failures in cfg(feature) code are a pain. We should be doing less of that.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 8, 2025

So one thing I was wondering is if we should be pulling {TestMode, TestSuite} from compiletest -> build_helpers then share that in bootstrap. The downside is that where do you put the stringify and stuff? Putting those in build_helpers seem fine. Though there's some prerequisite cleanups in compiletest to get rid of e.g. test build dir calculations that's added on {TestMode} or sth.

@jieyouxu
Copy link
Member

jieyouxu commented Dec 8, 2025

That being said, I'm also perfectly fine with keeping a separate copy in bootstrap, it's still way better than string matching

@Zalathar
Copy link
Member Author

Zalathar commented Dec 8, 2025

Yeah, I think having a duplicated enum is a clear win over bare strings, whereas trying to deduplicate the enum adds more complexity and hassle that isn't obviously worthwhile.

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.

Thanks, this is much nicer than the hacky string comparisons. You can r=me after a rebase.

View changes since this review

@jieyouxu
Copy link
Member

jieyouxu commented Dec 8, 2025

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 8, 2025
This derive was an artifact of test-only method `Cache::all` wanting to
automatically sort its output to hide HashMap iteration order.

We can achieve an equivalent result by requiring the caller to provide a
projection function that returns results that _are_ sortable.
@rustbot
Copy link
Collaborator

rustbot commented Dec 8, 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

Zalathar commented Dec 8, 2025

Rebased to fix a trivial conflict.

@bors r=jieyouxu

@bors
Copy link
Collaborator

bors commented Dec 8, 2025

📌 Commit dc8cdb1 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 8, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Dec 9, 2025
bootstrap: Use a `CompiletestMode` enum instead of bare strings

This gives better static checking when dealing with compiletest modes in bootstrap, especially for those modes that overlap with the name of a test suite directory.

r? jieyouxu (or bootstrap)
bors added a commit that referenced this pull request Dec 9, 2025
Rollup of 12 pull requests

Successful merges:

 - #147572 (std: Use more `unix.rs` code on WASI targets)
 - #148491 ( Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type)
 - #149215 (Emit `check-cfg` lints during attribute parsing rather than evaluation)
 - #149652 (Add release notes for 1.92.0)
 - #149720 (rustdoc book: mention inner doc attribute)
 - #149730 (lint: emit proper diagnostic for unsafe binders in improper_ctypes instead of ICE)
 - #149754 (Retire `opt_str2` from compiletest cli parsing)
 - #149755 (bootstrap: Use a `CompiletestMode` enum instead of bare strings)
 - #149763 (Add inline attribute to generated delegation function if needed)
 - #149772 (test: Add a test for 146133)
 - #149779 (Fix typo "an" → "and")
 - #149782 (Remove `[no-mentions]` handler in the triagebot config)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Dec 9, 2025
Rollup of 11 pull requests

Successful merges:

 - #147585 (Suppress the error for private fields with non_exhaustive attribute)
 - #149215 (Emit `check-cfg` lints during attribute parsing rather than evaluation)
 - #149652 (Add release notes for 1.92.0)
 - #149720 (rustdoc book: mention inner doc attribute)
 - #149730 (lint: emit proper diagnostic for unsafe binders in improper_ctypes instead of ICE)
 - #149754 (Retire `opt_str2` from compiletest cli parsing)
 - #149755 (bootstrap: Use a `CompiletestMode` enum instead of bare strings)
 - #149763 (Add inline attribute to generated delegation function if needed)
 - #149772 (test: Add a test for 146133)
 - #149779 (Fix typo "an" → "and")
 - #149782 (Remove `[no-mentions]` handler in the triagebot config)

Failed merges:

 - #148491 ( Correctly provide suggestions when encountering `async fn` with a `dyn Trait` return type)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b13a253 into rust-lang:main Dec 9, 2025
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Dec 9, 2025
rust-timer added a commit that referenced this pull request Dec 9, 2025
Rollup merge of #149755 - Zalathar:test-mode, r=jieyouxu

bootstrap: Use a `CompiletestMode` enum instead of bare strings

This gives better static checking when dealing with compiletest modes in bootstrap, especially for those modes that overlap with the name of a test suite directory.

r? jieyouxu (or bootstrap)
@Zalathar Zalathar deleted the test-mode branch December 9, 2025 12:01
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-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.

5 participants