Skip to content

Forbid check-pass/build-pass/run-pass directives in incremental tests#155589

Merged
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
Zalathar:cpass
Apr 22, 2026
Merged

Forbid check-pass/build-pass/run-pass directives in incremental tests#155589
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
Zalathar:cpass

Conversation

@Zalathar
Copy link
Copy Markdown
Member


This PR forbids the use of //@ check-pass, //@ build-pass, and //@ run-pass directives in incremental tests. Tests that would have used those directives should use a revision name beginning with cpass/bpass/rpass instead.

(The *-fail directives are already forbidden in incremental tests.)

Existing incremental tests that used the check-pass and build-pass directives have been migrated. To allow migration of the check-pass tests, this PR also adds support for revision names beginning with cpass. No incremental tests were using run-pass.


Several of the migrated build-pass tests have a FIXME indicating that they could potentially be migrated to check-pass instead. This PR does not perform that migration.

In the future, I intend to do more cleanup of how compiletest handles pass/fail expectations, but I didn't want to cram too much into one PR.

r? jieyouxu

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @tshepang

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 21, 2026
Copy link
Copy Markdown
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.

Comment on lines -5 to -8
//@ revisions: bfail1 bfail2
//@ revisions: bpass1 bpass2
//@ compile-flags: -Z query-dep-graph
//@ aux-build:point.rs
//@ build-pass
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: I was staring at this for like a good minute trying to understand why this previously worked... This is because the previous revision names are just misleading, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, that was one of the big confusions that prompted me to go down the path of trying to clean this stuff up.

For whatever reason, it used to be the case that bfail (historically cfail) was the only revision kind that supported *-pass directives and diagnostic checks. So if someone wanted those checks, they would use a bfail revision and combine it with directives to explicitly expect success instead of failure. Very confusing.

Comment thread tests/incremental/no_mangle.rs
@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 Apr 22, 2026
Comment thread src/doc/rustc-dev-guide/src/tests/directives.md
This is the subset of incremental tests that should continue to use `bpass`
even after `cpass` is supported, because they (presumably) involve codegen.
This is the subset of incremental tests that have a FIXME to consider migrating
to check-pass instead.

That migration is beyond the scope of this PR, but might be attempted later.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 22, 2026

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.

Incremental tests that would have used the `check-pass`, `build-pass`, or
`run-pass` directives should instead use a revision name starting with
`cpass`/`bpass`/`rpass` as appropriate.
Copy link
Copy Markdown
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, r=me once PR CI is green

View changes since this review

@Zalathar
Copy link
Copy Markdown
Member Author

PR CI is green.

@bors r=jieyouxu

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 22, 2026

📌 Commit 87ec57f has been approved by jieyouxu

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 22, 2026
@Zalathar
Copy link
Copy Markdown
Member Author

My longer-term plan is to eventually forbid *-pass and *-fail directives in all test modes other than TestMode::Ui, which should make it easier to then clean up handling of pass/fail expectations in UI tests.

I currently have a local draft PR to forbid *-pass and *-fail directives in tests/crashes.

@jieyouxu
Copy link
Copy Markdown
Member

My longer-term plan is to eventually forbid *-pass and *-fail directives in all test modes other than TestMode::Ui, which should make it easier to then clean up handling of pass/fail expectations in UI tests.

Sounds good 👍

rust-bors Bot pushed a commit that referenced this pull request Apr 22, 2026
Rollup of 7 pull requests

Successful merges:

 - #155589 (Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests)
 - #155610 (Add missing `dyn` keyword to `trait_alias` page of the Unstable Book)
 - #155615 (test cleanups for `ui/derives` and `ui/deriving`)
 - #154874 (Fix ICE for inherited const conditions on const closures)
 - #155605 (std: Update support for `wasm32-wasip3`)
 - #155613 (c-variadic: tweak `std` docs)
 - #155619 (Remove a bunch of unnecessary explicit lifetimes from the ast validator)
@rust-bors rust-bors Bot merged commit 2a68b22 into rust-lang:main Apr 22, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 22, 2026
rust-timer added a commit that referenced this pull request Apr 22, 2026
Rollup merge of #155589 - Zalathar:cpass, r=jieyouxu

Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests

- Follow-up to #155474
---

This PR forbids the use of `//@ check-pass`, `//@ build-pass`, and `//@ run-pass` directives in incremental tests. Tests that would have used those directives should use a revision name beginning with `cpass`/`bpass`/`rpass` instead.

(The `*-fail` directives are already forbidden in incremental tests.)

Existing incremental tests that used the `check-pass` and `build-pass` directives have been migrated. To allow migration of the check-pass tests, this PR also adds support for revision names beginning with `cpass`. No incremental tests were using `run-pass`.

---

Several of the migrated `build-pass` tests have a FIXME indicating that they could potentially be migrated to `check-pass` instead. This PR does not perform that migration.

In the future, I intend to do more cleanup of how compiletest handles pass/fail expectations, but I didn't want to cram too much into one PR.

r? jieyouxu
@Zalathar Zalathar deleted the cpass branch April 22, 2026 09:53
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 22, 2026
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155589 (Forbid `check-pass`/`build-pass`/`run-pass` directives in incremental tests)
 - rust-lang/rust#155610 (Add missing `dyn` keyword to `trait_alias` page of the Unstable Book)
 - rust-lang/rust#155615 (test cleanups for `ui/derives` and `ui/deriving`)
 - rust-lang/rust#154874 (Fix ICE for inherited const conditions on const closures)
 - rust-lang/rust#155605 (std: Update support for `wasm32-wasip3`)
 - rust-lang/rust#155613 (c-variadic: tweak `std` docs)
 - rust-lang/rust#155619 (Remove a bunch of unnecessary explicit lifetimes from the ast validator)
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-rustc-dev-guide Area: rustc-dev-guide 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants