Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix x test compiler unit tests under rust.parallel-compiler = true #130345

Closed
wants to merge 3 commits into from

Conversation

Zalathar
Copy link
Contributor

When running unit tests in compiler, bootstrap dutifully enables the rustc_use_parallel_compiler feature for the target crate, but that feature isn't automatically propagated to dependencies. That results in various bogus failures, such as crates depending on rustc_data_structures being unable to find rayon.

The fix is to add a rustc_use_parallel_compiler feature to more compiler crates, and forward it to the appropriate dependencies. We already have some of this, which is why the unit tests work in CI, but these changes restore the ability to unit-test individual compiler crates from the command line.

As a related bonus, this PR also conditionally ignores some doctests that are incompatible with the stage 0 compiler, because they rely on behaviour that hasn't made its way to beta yet.

@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2024
@Zalathar Zalathar added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) A-testsuite Area: The testsuite used to check the correctness of rustc A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust labels Sep 14, 2024
@Zalathar
Copy link
Contributor Author

Zalathar commented Sep 14, 2024

I would also like to add some testing of this to CI so that it doesn't regress, but it seems easier to pursue that as a separate step.

Comment on lines +31 to +38
[features]
# tidy-alphabetical-start
rustc_use_parallel_compiler = [
'rustc_data_structures/rustc_use_parallel_compiler',
'rustc_errors/rustc_use_parallel_compiler',
'rustc_middle/rustc_use_parallel_compiler',
]
# tidy-alphabetical-end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disclosure: x test tidy doesn't seem to actually enforce alphabetical ordering of these sub-lists, so the alphabetical check only applies to the top-level features.

Comment on lines +1873 to +1874
#[cfg_attr(bootstrap, doc = "```ignore")]
#[cfg_attr(not(bootstrap), doc = "```rust,compile_fail")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks to Boxy for helping me figure out how to actually do this. ✨

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we have multiple checks using hand-rolled parsers that don't understand this pattern, so I've had to “fix” one and trick the other.

@rust-log-analyzer

This comment has been minimized.

@Zalathar Zalathar force-pushed the absolute-unit branch 3 times, most recently from 00e0042 to 0ad5711 Compare September 14, 2024 09:09
@rust-log-analyzer

This comment has been minimized.

These changes can be reverted during the next bootstrap bump.
This fixes `x test compiler` under `rust.parallel-compiler = true`.
@Zalathar
Copy link
Contributor Author

Zalathar commented Sep 14, 2024

Hmm, or maybe we should just make the rayon dependency unconditional and sidestep the whole feature mess, as multiple people have suggested.

@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 Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants