Skip to content

Add the option to run UI tests with the parallel frontend#153801

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
ywxt:parallel-test
Mar 17, 2026
Merged

Add the option to run UI tests with the parallel frontend#153801
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
ywxt:parallel-test

Conversation

@ywxt
Copy link
Contributor

@ywxt ywxt commented Mar 13, 2026

This PR adds two arguments for tests:

  1. --parallel-frontend-threads: specify -Zthread to compile test case (currently UI tests only)
  2. --iteration-count: the number of times to run each test

Also, due to the non-deterministic diagnostic orders and cycle errors, this PR adds the directive //@ ignore-parallel-frontend to ignore tests with cycle error when the parallel-frontend is enabled (by --parallel-frontend-threads) and enables //@ compare-output-by-lines by default.

Context: #t-compiler/parallel-rustc > Add the parallel front-end test suite @ 💬

This PR should work with #153797 together.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 Mar 13, 2026
@rust-log-analyzer

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Mar 13, 2026
@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 13, 2026
@petrochenkov
Copy link
Contributor

This may be a bit silly, but to avoid many unnecessary changes in stderr files you could put the //@ ignore-parallel-frontend into the first empty lines in tests, like I did with //@ check-pass in #151130 (the directives shouldn't necessarily be at the top).
Hopefully the ignores will be removed away sooner or later, so this way we'll avoid thrashing the files on both directive addition and removal. (Now majority of the diff is meaningless stderr file changes.)

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 13, 2026

What exactly failures are ignored by ignore-parallel-frontend in practice?
Are they .stderr file comparison errors, or there are //~ ERROR annotation mismatches too?

Right now ignore-parallel-frontend ignores the test entirely, but maybe we could ignore only some of the checks.

@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

What exactly failures are ignored by ignore-parallel-frontend in practice? Are they .stderr file comparison errors, or there are //~ ERROR annotation mismatches too?

Right now ignore-parallel-frontend ignores the test entirely, but maybe we could ignore only some of the checks.

failures would produce different errors so that //~ ERROR annotation mismatches

@petrochenkov petrochenkov 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 Mar 13, 2026
@ywxt
Copy link
Contributor Author

ywxt commented Mar 13, 2026

diff of stderr:

105     LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) }; // errors inside libcore
106        |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `R1` failed here
107
-       error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got ALLOC10 which is only 4 bytes from the end of the allocation
109       --> $DIR/forbidden_slices.rs:54:25
110        |
111     LL |     from_ptr_range(ptr..ptr.add(2)) // errors inside libcore

157                    HEX_DUMP
158                }
159
-       error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got ALLOC11+0x1 which is only 7 bytes from the end of the allocation
161       --> $DIR/forbidden_slices.rs:79:25
162        |
163     LL |     from_ptr_range(ptr..ptr.add(1))

actual:

error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got alloc66+0x1 which is only 7 bytes from the end of the allocation
  --> /home/ywxt/Projects/Rust/rust/tests/ui/const-ptr/forbidden_slices.rs:79:25
   |
LL |     from_ptr_range(ptr..ptr.add(1))
   |                         ^^^^^^^^^^ evaluation of `R8` failed here

error[E0080]: in-bounds pointer arithmetic failed: attempting to offset pointer by 8 bytes, but got alloc69 which is only 4 bytes from the end of the allocation
  --> /home/ywxt/Projects/Rust/rust/tests/ui/const-ptr/forbidden_slices.rs:54:25
   |
LL |     from_ptr_range(ptr..ptr.add(2)) // errors inside libcore
   |                         ^^^^^^^^^^ evaluation of `R2` failed here

The difference is from alloc ids. Should we mask all of them?

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 13, 2026

It may be possible to normalize them instead of ignoring.
I'd ping the author of the test and ask their opinion.

@ywxt ywxt force-pushed the parallel-test branch 2 times, most recently from 67ebcd0 to 414d715 Compare March 13, 2026 16:44
@@ -1,5 +1,5 @@
//@ dont-require-annotations: NOTE

//@ ignore-parallel-frontend different alloc ids
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add normalization rules if it's confirmed.

//@ stderr-per-bitwidth
//@ dont-require-annotations: NOTE

//@ ignore-parallel-frontend different alloc ids
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although some consts tests didn't get failed in my environment, I marked them as ignored due to alloc ids in stderr.

//@ compile-flags: --force-warn unused_mut
//@ check-pass

//@ ignore-parallel-frontend the message `requested on the ...` appears in different lines
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The message is reported on two different source lines. Maybe we can solve it by comparison approaches?

//@ compile-flags: -Z query-dep-graph

//@ ignore-parallel-frontend dep graph
#![feature(rustc_attrs)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dep graph tests failed on some rustc_then_this_would_need attributes.

Do you know the detail? @zetanumbers @Zoxc

Copy link
Contributor

Choose a reason for hiding this comment

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

I was able to reproduce a failure on main. It seems to be non-deterministic. Perhaps #152621 helps. I haven't looked into the issues with -Z query-dep-graph.

@ywxt ywxt force-pushed the parallel-test branch 2 times, most recently from d9c6a67 to 5aeb919 Compare March 14, 2026 03:05
@ywxt
Copy link
Contributor Author

ywxt commented Mar 14, 2026

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 14, 2026
@petrochenkov petrochenkov marked this pull request as ready for review March 14, 2026 17:32
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 14, 2026

Some changes occurred in src/tools/compiletest

cc @jieyouxu

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

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 14, 2026
@petrochenkov petrochenkov 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 Mar 14, 2026
@zetanumbers
Copy link
Contributor

zetanumbers commented Mar 16, 2026

Just as I've said before in #t-compiler/parallel-rustc > Add the parallel front-end test suite @ 💬, I would like to see individual parallel rustc tests to be done sequentially. This way each rustc process would utilize CPU cores without much of context switching and as I believe reaching better parallel front-end coverage.

@petrochenkov
Copy link
Contributor

r=me after removing the bless condition from parallel_frontend_enabled and updating the dev guide accordingly.

All the possible improvements like #153801 (comment) and #153801 (comment) can be done once the general support is merged and the tests start running on CI.

@ywxt
Copy link
Contributor Author

ywxt commented Mar 16, 2026

---- [ui] tests/ui/consts/const-eval/issue-50814-2.rs#normal stdout ----
Saved the actual stderr to `/root/rust/rust/build/x86_64-unknown-linux-gnu/test/ui/consts/const-eval/issue-50814-2.normal/issue-50814-2.normal.stderr`
diff of stderr:

30      LL |     println!("{:x}", foo::<()>() as *const usize as usize);
31         |                      ^^^^^^^^^^^
32
+       note: the above error was encountered while instantiating `fn std::rt::lang_start::<()>`
+
33      error: aborting due to 1 previous error
34
35      For more information about this error, try `rustc --explain E0080`.
---- [ui] tests/ui/abi/simd-abi-checks-avx.rs stdout ----
Saved the actual stderr to `/root/rust/rust/build/x86_64-unknown-linux-gnu/test/ui/abi/simd-abi-checks-avx/simd-abi-checks-avx.stderr`
diff of stderr:

92      LL |         in_closure()();
93         |         ^^^^^^^^^^^^^^
94
+       note: the above error was encountered while instantiating `fn std::rt::lang_start::<()>`
+
95      error: aborting due to 11 previous errors
96
97

some new failures under the parallel frontend due to the new note note: the above error was encountered while instantiating fn std::rt::lang_start::<()>`. Anyone knows it?

failures:
    [ui] tests/ui/abi/simd-abi-checks-avx.rs
    [ui] tests/ui/consts/const-eval/issue-50814-2.rs#mir-opt
    [ui] tests/ui/consts/mono-reachable-invalid-const.rs
    [ui] tests/ui/consts/required-consts/collect-in-called-fn.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-called-fn.rs#opt
    [ui] tests/ui/consts/required-consts/collect-in-dead-closure.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-closure.rs#opt
    [ui] tests/ui/consts/required-consts/collect-in-dead-drop.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs#opt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs#opt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fn.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fnptr.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-fnptr.rs#opt
    [ui] tests/ui/consts/required-consts/collect-in-dead-move.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-promoted-const.rs#noopt
    [ui] tests/ui/consts/required-consts/collect-in-dead-move.rs#opt
    [ui] tests/ui/lint/large_assignments/inline_mir.rs
    [ui] tests/ui/lint/large_assignments/move_into_fn.rs
    [ui] tests/ui/lint/large_assignments/copy_into_box_rc_arc.rs
    [ui] tests/ui/lint/large_assignments/copy_into_fn.rs
    [ui] tests/ui/lint/large_assignments/large_future.rs#attribute
    [ui] tests/ui/lint/non-snake-case/lint-uppercase-variables.rs
    [ui] tests/ui/rust-2018/edition-lint-inter-outlives/edition-lint-infer-outlives-macro.rs
    [ui] tests/ui/simd/const-err-trumps-simd-err.rs
    [ui] tests/ui/structs/default-field-values/post-mono.rs#indirect

@Kobzol Kobzol changed the title Run ui tests on the parallel frontend Add the option to run UI tests with the parallel frontend Mar 16, 2026
@Zoxc
Copy link
Contributor

Zoxc commented Mar 16, 2026

@ywxt Sounds like #85633, which does have race conditions

@petrochenkov
Copy link
Contributor

@ywxt Sounds like #85633, which does have race conditions

I first thought about #153194, but it's not even merged yet :D

@ywxt
Copy link
Contributor Author

ywxt commented Mar 16, 2026

@ywxt Sounds like #85633, which does have race conditions

I think it should be a new commit. I didn't find it before at all.

#153797 might make it exposed.

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 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.

@petrochenkov
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 17, 2026

📌 Commit 6a0ce16 has been approved by petrochenkov

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 Mar 17, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Mar 17, 2026
Add the option to run UI tests with the parallel frontend

This PR adds two arguments for tests:

1. `--parallel-frontend-threads`: specify `-Zthread` to compile test case (currently UI tests only)
2. `--iteration-count`: the number of times to run each test

Also, due to the non-deterministic diagnostic orders and cycle errors, this PR adds the directive `//@ ignore-parallel-frontend` to ignore tests with cycle error when the parallel-frontend is enabled (by `--parallel-frontend-threads`) and enables `//@ compare-output-by-lines` by default.

Context: [#t-compiler/parallel-rustc > Add the parallel front-end test suite @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Add.20the.20parallel.20front-end.20test.20suite/near/578781369)

This PR should work with rust-lang#153797 together.
rust-bors bot pushed a commit that referenced this pull request Mar 17, 2026
Rollup of 7 pull requests

Successful merges:

 - #153801 (Add the option to run UI tests with the parallel frontend)
 - #153967 (Tweak wording of failed predicate in inference error)
 - #152968 (Flip "region lattice" in RegionKind doc comment)
 - #153531 (Fix LegacyKeyValueFormat report from docker build: various)
 - #153709 (Fix hypothetical ICE in `variances_of`)
 - #153884 (test `classify-runtime-const` for `f16`)
 - #153946 (dissolve `tests/ui/cross`)
rust-bors bot pushed a commit that referenced this pull request Mar 17, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #153972 (stdarch subtree update)
 - #153801 (Add the option to run UI tests with the parallel frontend)
 - #153959 (Fix non-module `parent_module` in stripped cfg diagnostics)
 - #153967 (Tweak wording of failed predicate in inference error)
 - #152968 (Flip "region lattice" in RegionKind doc comment)
 - #153531 (Fix LegacyKeyValueFormat report from docker build: various)
 - #153622 (remove concept of soft-unstable features)
 - #153709 (Fix hypothetical ICE in `variances_of`)
 - #153884 (test `classify-runtime-const` for `f16`)
 - #153894 (Point at unit structs on foreign crates in type errors when they are the pattern of a binding)
 - #153920 (improve `#[track_caller]` invalid ABI error)
 - #153946 (dissolve `tests/ui/cross`)
 - #153965 (Fix minor kasan bugs)
 - #153991 (Small report_cycle refactor)
@rust-bors rust-bors bot merged commit fe68164 into rust-lang:main Mar 17, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 17, 2026
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 18, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#153972 (stdarch subtree update)
 - rust-lang/rust#153801 (Add the option to run UI tests with the parallel frontend)
 - rust-lang/rust#153959 (Fix non-module `parent_module` in stripped cfg diagnostics)
 - rust-lang/rust#153967 (Tweak wording of failed predicate in inference error)
 - rust-lang/rust#152968 (Flip "region lattice" in RegionKind doc comment)
 - rust-lang/rust#153531 (Fix LegacyKeyValueFormat report from docker build: various)
 - rust-lang/rust#153622 (remove concept of soft-unstable features)
 - rust-lang/rust#153709 (Fix hypothetical ICE in `variances_of`)
 - rust-lang/rust#153884 (test `classify-runtime-const` for `f16`)
 - rust-lang/rust#153894 (Point at unit structs on foreign crates in type errors when they are the pattern of a binding)
 - rust-lang/rust#153920 (improve `#[track_caller]` invalid ABI error)
 - rust-lang/rust#153946 (dissolve `tests/ui/cross`)
 - rust-lang/rust#153965 (Fix minor kasan bugs)
 - rust-lang/rust#153991 (Small report_cycle refactor)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Mar 18, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#153972 (stdarch subtree update)
 - rust-lang/rust#153801 (Add the option to run UI tests with the parallel frontend)
 - rust-lang/rust#153959 (Fix non-module `parent_module` in stripped cfg diagnostics)
 - rust-lang/rust#153967 (Tweak wording of failed predicate in inference error)
 - rust-lang/rust#152968 (Flip "region lattice" in RegionKind doc comment)
 - rust-lang/rust#153531 (Fix LegacyKeyValueFormat report from docker build: various)
 - rust-lang/rust#153622 (remove concept of soft-unstable features)
 - rust-lang/rust#153709 (Fix hypothetical ICE in `variances_of`)
 - rust-lang/rust#153884 (test `classify-runtime-const` for `f16`)
 - rust-lang/rust#153894 (Point at unit structs on foreign crates in type errors when they are the pattern of a binding)
 - rust-lang/rust#153920 (improve `#[track_caller]` invalid ABI error)
 - rust-lang/rust#153946 (dissolve `tests/ui/cross`)
 - rust-lang/rust#153965 (Fix minor kasan bugs)
 - rust-lang/rust#153991 (Small report_cycle refactor)
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.

8 participants