Skip to content

compiletest: Migrate from PassMode/FailMode to PassFailMode#156129

Open
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:pass-fail
Open

compiletest: Migrate from PassMode/FailMode to PassFailMode#156129
Zalathar wants to merge 3 commits intorust-lang:mainfrom
Zalathar:pass-fail

Conversation

@Zalathar
Copy link
Copy Markdown
Member

@Zalathar Zalathar commented May 4, 2026

Every UI test has an explicit or implicit “pass/fail mode” (e.g. check-fail or build-pass) that was historically stored in two separate optional fields (pass_mode and fail_mode). That split made it very hard to determine how the respective values were actually produced and consumed, especially in the presence of --pass=check on the command-line, or when building auxiliary crates.

This PR replaces the separate fields and enums for pass-mode and fail-mode with a single PassFailMode enum and a single pass_fail_mode field.

With this new representation, it should hopefully be easier to understand and modify the pass/fail-mode logic.


In order to focus on the main migration, I have mostly refrained from subsequent cleanups.

r? jieyouxu

Zalathar added 3 commits May 4, 2026 13:19
This commit introduces `PassFailMode` as an internal detail of `TestProps`, but
the full migration is left to a subsequent commit.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 4, 2026

compiletest directives have been modified. Please add or update docs for the
new or modified directive in src/doc/rustc-dev-guide/.

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner 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 May 4, 2026
@rust-log-analyzer

This comment has been minimized.

// exit code and actual run result in the failure message.
let pass_hint = format!("code={code:?} so test would pass with `{run_result}`");
if self.should_run_successfully(pm) {
if pass_fail == PassFailMode::RunPass {
Copy link
Copy Markdown
Member

@fmease fmease May 4, 2026

Choose a reason for hiding this comment

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

This whole if/else chain can now be a nice match.

I have read

In order to focus on the main migration, I have mostly refrained from subsequent cleanups.

but IMO this would be a trivial improvement.

View changes since the review

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

Labels

A-compiletest Area: The compiletest test runner 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.

5 participants