Fix race in two Clippy UI tests.#17406
Conversation
|
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 (
|
|
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`.
|
r? @llogiq rustbot has assigned @llogiq for the project review. Use Why was this reviewer chosen?The reviewer was selected based on:
|
By two team members even. Appropriately apparently. |
You are part of the community after all. |
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.rsis not declared, ui_test does not pass an explicit--extern proc_macros=.../libproc_macros.sofor these tests. The tests can still appear to work when another test has already builtproc_macros.rs, because rustc then finds it through the shared-L .../tests/ui/auxiliarydirectory.That fallback is racy. During a parallel Clippy UI run, the auxiliary build can leave
libproc_macros.rmetavisible beforelibproc_macros.sois 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 inrustc_metadata::creaderwith:no dylib for a proc-macro crate
Adding
//@aux-build:proc_macros.rsmakes the dependency explicit, forcing ui_test to buildproc_macros.rsbefore running the test and to pass the proc-macro dylib through--extern.changelog: none