clippy: add missing proc_macros aux-build declarations.#159147
Conversation
|
cc @rust-lang/clippy |
|
Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @jieyouxu (or someone else) some time within the next two weeks. 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 (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
Ok, opened a PR at rust-lang/rust-clippy#17406 . Still good to record here that this problem exists starting with the rust release 1.94.1 and following (at least). non_canonical_clone_impl.rs: bug present since rust 1.81.0. Earlier versions didnt use proc macros. |
This comment has been minimized.
This comment has been minimized.
Fix two Clippy UI tests that import the `proc_macros` auxiliary crate without declaring it as an aux-build dependency. 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`.
|
I'd say let's close this one in favor of the clippy PR? To avoid wasting CI cycles |
Fix two Clippy UI tests that import the
proc_macrosauxiliary crate without declaring it as an aux-build dependency.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.Happened to me when building rust (1.94.1 specifically) on a 64 core amd epyc.