Skip to content

Fix race in two Clippy UI tests.#17406

Merged
samueltardieu merged 1 commit into
rust-lang:masterfrom
daym:clippy-test-race
Jul 11, 2026
Merged

Fix race in two Clippy UI tests.#17406
samueltardieu merged 1 commit into
rust-lang:masterfrom
daym:clippy-test-race

Conversation

@daym

@daym daym commented Jul 11, 2026

Copy link
Copy Markdown

Both tests only declare:

//@aux-build:proc_macro_derive.rs

but they also contain:

extern crate proc_macros;
use proc_macros::inline_macros;

Because proc_macros.rs is not declared, ui_test does not pass an explicit --extern proc_macros=.../libproc_macros.so for these tests. The tests can still appear to work when another test has already built proc_macros.rs, because rustc then finds it through the shared -L .../tests/ui/auxiliary directory.

That fallback is racy. During a parallel Clippy UI run, the auxiliary build can leave libproc_macros.rmeta visible before libproc_macros.so is written. If one of these tests starts in that window, rustc loads metadata for a proc-macro crate but has no dylib in the crate source, then ICEs in rustc_metadata::creader with:

no dylib for a proc-macro crate

Adding //@aux-build:proc_macros.rs makes the dependency explicit, forcing ui_test to build proc_macros.rs before running the test and to pass the proc-macro dylib through --extern.

changelog: none

@rustbot rustbot added the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Jul 11, 2026
@rustbot

rustbot commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome!

You should hear from one of our reviewers after this PR gets at least 2 reviews from the community.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 11, 2026
@ada4a

ada4a commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Please re-bless the tests using the following command:

TESTNAME=non_canonical_partial_ord_impl,non_canonical_clone_impl cargo uibless

(see https://doc.rust-lang.org/clippy/development/adding_lints.html#testing)

Both tests only declare:

  //@aux-build:proc_macro_derive.rs

but they also contain:

  extern crate proc_macros;
  use proc_macros::inline_macros;

Because `proc_macros.rs` is not declared, ui_test does not pass an explicit
`--extern proc_macros=.../libproc_macros.so` for these tests.  The tests can
still appear to work when another test has already built `proc_macros.rs`,
because rustc then finds it through the shared `-L .../tests/ui/auxiliary`
directory.

That fallback is racy.  During a parallel Clippy UI run, the auxiliary build can
leave `libproc_macros.rmeta` visible before `libproc_macros.so` is written.  If
one of these tests starts in that window, rustc loads metadata for a proc-macro
crate but has no dylib in the crate source, then ICEs in
`rustc_metadata::creader` with:

  no dylib for a proc-macro crate

Adding `//@aux-build:proc_macros.rs` makes the dependency explicit, forcing
ui_test to build `proc_macros.rs` before running the test and to pass the
proc-macro dylib through `--extern`.
@daym
daym force-pushed the clippy-test-race branch from 3b1d70a to 061b37a Compare July 11, 2026 19:25

@ada4a ada4a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thank you:)

Let's see how triagebot reacts to a community review by a team member..

View changes since this review

@rustbot rustbot removed the S-waiting-on-community-reviews Status: This is awaiting for positive reviews from the community before a maintainer is assigned. label Jul 11, 2026
@rustbot

rustbot commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

r? @llogiq

rustbot has assigned @llogiq for the project review.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 8 candidates
  • 8 candidates expanded to 8 candidates
  • Random selection from Jarcho, llogiq

@samueltardieu

Copy link
Copy Markdown
Member

LGTM, thank you:)

Let's see how triagebot reacts to a community review by a team member..

By two team members even. Appropriately apparently.

@samueltardieu
samueltardieu added this pull request to the merge queue Jul 11, 2026
Merged via the queue into rust-lang:master with commit 430a22c Jul 11, 2026
8 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 11, 2026
@Urgau

Urgau commented Jul 13, 2026

Copy link
Copy Markdown
Member

LGTM, thank you:)
Let's see how triagebot reacts to a community review by a team member..

By two team members even. Appropriately apparently.

You are part of the community after all.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants