diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-07-11 20:00:30 +0200 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2026-07-20 02:35:36 +0200 |
| commit | aa8d7df51fcbe9621b3a3bdcdbd7373c66e4a567 (patch) | |
| tree | 746794df72a7272ca5d3eb0fe064cf319d5a2cca /gnu/packages | |
| parent | 214e02121d3b3393234fe99657462ce8d7f67ef1 (diff) | |
gnu: rust@1.94: Fix clippy test race.
* gnu/packages/patches/rust-1.94-clippy-fix-proc-macros-aux-race.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.
* gnu/packages/rust.scm (rust-1.94)[source]: Add reference to it.
Merges: guix/guix#9877
Diffstat (limited to 'gnu/packages')
| -rw-r--r-- | gnu/packages/patches/rust-1.94-clippy-fix-proc-macros-aux-race.patch | 170 | ||||
| -rw-r--r-- | gnu/packages/rust.scm | 2 |
2 files changed, 172 insertions, 0 deletions
diff --git a/gnu/packages/patches/rust-1.94-clippy-fix-proc-macros-aux-race.patch b/gnu/packages/patches/rust-1.94-clippy-fix-proc-macros-aux-race.patch new file mode 100644 index 00000000000..b7d0abc35be --- /dev/null +++ b/gnu/packages/patches/rust-1.94-clippy-fix-proc-macros-aux-race.patch | |||
| @@ -0,0 +1,170 @@ | |||
| 1 | Upstream-status: https://github.com/rust-lang/rust-clippy/pull/17406 | ||
| 2 | From: Danny Milosavljevic <dannym@friendly-machines.com> | ||
| 3 | Subject: clippy: add missing proc_macros aux-build declarations. | ||
| 4 | Date: 2026-07-11 | ||
| 5 | License: expat | ||
| 6 | |||
| 7 | Fix two Clippy UI tests that import the `proc_macros` auxiliary crate without | ||
| 8 | declaring it as an aux-build dependency. | ||
| 9 | |||
| 10 | Both tests only declare: | ||
| 11 | |||
| 12 | //@aux-build:proc_macro_derive.rs | ||
| 13 | |||
| 14 | but they also contain: | ||
| 15 | |||
| 16 | extern crate proc_macros; | ||
| 17 | use proc_macros::inline_macros; | ||
| 18 | |||
| 19 | Because `proc_macros.rs` is not declared, ui_test does not pass an explicit | ||
| 20 | `--extern proc_macros=.../libproc_macros.so` for these tests. The tests can | ||
| 21 | still appear to work when another test has already built `proc_macros.rs`, | ||
| 22 | because rustc then finds it through the shared `-L .../tests/ui/auxiliary` | ||
| 23 | directory. | ||
| 24 | |||
| 25 | That fallback is racy. During a parallel Clippy UI run, the auxiliary build can | ||
| 26 | leave `libproc_macros.rmeta` visible before `libproc_macros.so` is written. If | ||
| 27 | one of these tests starts in that window, rustc loads metadata for a proc-macro | ||
| 28 | crate but has no dylib in the crate source, then ICEs in | ||
| 29 | `rustc_metadata::creader` with: | ||
| 30 | |||
| 31 | no dylib for a proc-macro crate | ||
| 32 | |||
| 33 | Adding `//@aux-build:proc_macros.rs` makes the dependency explicit, forcing | ||
| 34 | ui_test to build `proc_macros.rs` before running the test and to pass the | ||
| 35 | proc-macro dylib through `--extern`. | ||
| 36 | |||
| 37 | diff --git a/src/tools/clippy/tests/ui/non_canonical_clone_impl.fixed b/src/tools/clippy/tests/ui/non_canonical_clone_impl.fixed | ||
| 38 | index d9be98d..b50455c 100644 | ||
| 39 | --- a/src/tools/clippy/tests/ui/non_canonical_clone_impl.fixed | ||
| 40 | +++ b/src/tools/clippy/tests/ui/non_canonical_clone_impl.fixed | ||
| 41 | @@ -1,4 +1,5 @@ | ||
| 42 | //@aux-build:proc_macro_derive.rs | ||
| 43 | +//@aux-build:proc_macros.rs | ||
| 44 | #![allow(clippy::clone_on_copy, unused)] | ||
| 45 | #![allow(clippy::assigning_clones)] | ||
| 46 | #![no_main] | ||
| 47 | diff --git a/src/tools/clippy/tests/ui/non_canonical_clone_impl.rs b/src/tools/clippy/tests/ui/non_canonical_clone_impl.rs | ||
| 48 | index 3db22bd..6e1974b 100644 | ||
| 49 | --- a/src/tools/clippy/tests/ui/non_canonical_clone_impl.rs | ||
| 50 | +++ b/src/tools/clippy/tests/ui/non_canonical_clone_impl.rs | ||
| 51 | @@ -1,4 +1,5 @@ | ||
| 52 | //@aux-build:proc_macro_derive.rs | ||
| 53 | +//@aux-build:proc_macros.rs | ||
| 54 | #![allow(clippy::clone_on_copy, unused)] | ||
| 55 | #![allow(clippy::assigning_clones)] | ||
| 56 | #![no_main] | ||
| 57 | diff --git a/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr b/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr | ||
| 58 | index cf36a8f..86e01d0 100644 | ||
| 59 | --- a/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr | ||
| 60 | +++ b/src/tools/clippy/tests/ui/non_canonical_clone_impl.stderr | ||
| 61 | @@ -1,5 +1,5 @@ | ||
| 62 | error: non-canonical implementation of `clone` on a `Copy` type | ||
| 63 | - --> tests/ui/non_canonical_clone_impl.rs:14:29 | ||
| 64 | + --> tests/ui/non_canonical_clone_impl.rs:15:29 | ||
| 65 | | | ||
| 66 | LL | fn clone(&self) -> Self { | ||
| 67 | | _____________________________^ | ||
| 68 | @@ -12,7 +12,7 @@ LL | | } | ||
| 69 | = help: to override `-D warnings` add `#[allow(clippy::non_canonical_clone_impl)]` | ||
| 70 | |||
| 71 | error: unnecessary implementation of `clone_from` on a `Copy` type | ||
| 72 | - --> tests/ui/non_canonical_clone_impl.rs:19:5 | ||
| 73 | + --> tests/ui/non_canonical_clone_impl.rs:20:5 | ||
| 74 | | | ||
| 75 | LL | / fn clone_from(&mut self, source: &Self) { | ||
| 76 | LL | | | ||
| 77 | @@ -22,7 +22,7 @@ LL | | } | ||
| 78 | | |_____^ help: remove it | ||
| 79 | |||
| 80 | error: non-canonical implementation of `clone` on a `Copy` type | ||
| 81 | - --> tests/ui/non_canonical_clone_impl.rs:87:29 | ||
| 82 | + --> tests/ui/non_canonical_clone_impl.rs:88:29 | ||
| 83 | | | ||
| 84 | LL | fn clone(&self) -> Self { | ||
| 85 | | _____________________________^ | ||
| 86 | @@ -32,7 +32,7 @@ LL | | } | ||
| 87 | | |_____^ help: change this to: `{ *self }` | ||
| 88 | |||
| 89 | error: unnecessary implementation of `clone_from` on a `Copy` type | ||
| 90 | - --> tests/ui/non_canonical_clone_impl.rs:92:5 | ||
| 91 | + --> tests/ui/non_canonical_clone_impl.rs:93:5 | ||
| 92 | | | ||
| 93 | LL | / fn clone_from(&mut self, source: &Self) { | ||
| 94 | LL | | | ||
| 95 | @@ -42,7 +42,7 @@ LL | | } | ||
| 96 | | |_____^ help: remove it | ||
| 97 | |||
| 98 | error: non-canonical implementation of `clone` on a `Copy` type | ||
| 99 | - --> tests/ui/non_canonical_clone_impl.rs:127:37 | ||
| 100 | + --> tests/ui/non_canonical_clone_impl.rs:128:37 | ||
| 101 | | | ||
| 102 | LL | fn clone(&self) -> Self { | ||
| 103 | | _____________________________________^ | ||
| 104 | diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.fixed b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.fixed | ||
| 105 | index aa23fd9..526497c 100644 | ||
| 106 | --- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.fixed | ||
| 107 | +++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.fixed | ||
| 108 | @@ -1,4 +1,5 @@ | ||
| 109 | //@aux-build:proc_macro_derive.rs | ||
| 110 | +//@aux-build:proc_macros.rs | ||
| 111 | #![no_main] | ||
| 112 | |||
| 113 | extern crate proc_macros; | ||
| 114 | diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.rs b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.rs | ||
| 115 | index da7f73f..cff9881 100644 | ||
| 116 | --- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.rs | ||
| 117 | +++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.rs | ||
| 118 | @@ -1,4 +1,5 @@ | ||
| 119 | //@aux-build:proc_macro_derive.rs | ||
| 120 | +//@aux-build:proc_macros.rs | ||
| 121 | #![no_main] | ||
| 122 | |||
| 123 | extern crate proc_macros; | ||
| 124 | diff --git a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr | ||
| 125 | index a134df1..718d640 100644 | ||
| 126 | --- a/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr | ||
| 127 | +++ b/src/tools/clippy/tests/ui/non_canonical_partial_ord_impl.stderr | ||
| 128 | @@ -1,5 +1,5 @@ | ||
| 129 | error: non-canonical implementation of `partial_cmp` on an `Ord` type | ||
| 130 | - --> tests/ui/non_canonical_partial_ord_impl.rs:20:1 | ||
| 131 | + --> tests/ui/non_canonical_partial_ord_impl.rs:21:1 | ||
| 132 | | | ||
| 133 | LL | / impl PartialOrd for A { | ||
| 134 | LL | | | ||
| 135 | @@ -15,7 +15,7 @@ LL | | } | ||
| 136 | = help: to override `-D warnings` add `#[allow(clippy::non_canonical_partial_ord_impl)]` | ||
| 137 | |||
| 138 | error: non-canonical implementation of `partial_cmp` on an `Ord` type | ||
| 139 | - --> tests/ui/non_canonical_partial_ord_impl.rs:55:1 | ||
| 140 | + --> tests/ui/non_canonical_partial_ord_impl.rs:56:1 | ||
| 141 | | | ||
| 142 | LL | / impl PartialOrd for C { | ||
| 143 | LL | | | ||
| 144 | @@ -34,7 +34,7 @@ LL + fn partial_cmp(&self, other: &Self) -> Option<Ordering> { Some(self.cmp | ||
| 145 | | | ||
| 146 | |||
| 147 | error: non-canonical implementation of `partial_cmp` on an `Ord` type | ||
| 148 | - --> tests/ui/non_canonical_partial_ord_impl.rs:191:9 | ||
| 149 | + --> tests/ui/non_canonical_partial_ord_impl.rs:192:9 | ||
| 150 | | | ||
| 151 | LL | / impl PartialOrd for A { | ||
| 152 | LL | | | ||
| 153 | @@ -49,7 +49,7 @@ LL | | } | ||
| 154 | = note: this error originates in the macro `__inline_mac_mod_issue12788` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
| 155 | |||
| 156 | error: non-canonical implementation of `partial_cmp` on an `Ord` type | ||
| 157 | - --> tests/ui/non_canonical_partial_ord_impl.rs:271:1 | ||
| 158 | + --> tests/ui/non_canonical_partial_ord_impl.rs:272:1 | ||
| 159 | | | ||
| 160 | LL | / impl PartialOrd for K { | ||
| 161 | LL | | | ||
| 162 | @@ -62,7 +62,7 @@ LL | | } | ||
| 163 | | |__^ | ||
| 164 | |||
| 165 | error: non-canonical implementation of `partial_cmp` on an `Ord` type | ||
| 166 | - --> tests/ui/non_canonical_partial_ord_impl.rs:289:1 | ||
| 167 | + --> tests/ui/non_canonical_partial_ord_impl.rs:290:1 | ||
| 168 | | | ||
| 169 | LL | / impl PartialOrd for L { | ||
| 170 | LL | | | ||
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 21c98d294b5..82e544a8274 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm | |||
| @@ -1838,6 +1838,8 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc")) | |||
| 1838 | (source | 1838 | (source |
| 1839 | (origin | 1839 | (origin |
| 1840 | (inherit (package-source base-rust)) | 1840 | (inherit (package-source base-rust)) |
| 1841 | (patches (search-patches | ||
| 1842 | "rust-1.94-clippy-fix-proc-macros-aux-race.patch")) | ||
| 1841 | (snippet | 1843 | (snippet |
| 1842 | '(begin | 1844 | '(begin |
| 1843 | (for-each delete-file-recursively | 1845 | (for-each delete-file-recursively |
