* [PATCH] rust: allow `clippy::as_underscore` in the generated bindings
@ 2026-09-06 21:58 John Hubbard
2026-09-06 22:48 ` Miguel Ojeda
2026-09-06 23:10 ` Miguel Ojeda
0 siblings, 2 replies; 5+ messages in thread
From: John Hubbard @ 2026-09-06 21:58 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, Greg Kroah-Hartman, rust-for-linux, LKML,
John Hubbard
A CLIPPY=1 build emitted about 15000 `as _` conversion warnings, all of
them in bindgen's generated output and none in hand-written code.
bindgen 0.73 returns each bitfield read through a trailing `as _`, and
0.72 returns it through a transmute, which the lint ignores. The
bindings and uapi crates allow `clippy::all` over the generated code.
That group does not cover `clippy::as_underscore`, a restriction lint.
The minimum supported bindgen is 0.71.1, and 0.72 does not emit the
cast, so upstream CI may not see these warnings yet.
Allow `clippy::as_underscore` by name in the bindings and uapi crates.
Assisted-by: LLM
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
rust/bindings/lib.rs | 1 +
rust/uapi/lib.rs | 1 +
2 files changed, 2 insertions(+)
diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs
index 812f8e5a08d5..ad24c920b919 100644
--- a/rust/bindings/lib.rs
+++ b/rust/bindings/lib.rs
@@ -22,6 +22,7 @@
#![feature(cfi_encoding)]
#[allow(dead_code)]
+#[allow(clippy::as_underscore)]
#[allow(clippy::cast_lossless)]
#[allow(clippy::ptr_as_ptr)]
#[allow(clippy::ref_as_ptr)]
diff --git a/rust/uapi/lib.rs b/rust/uapi/lib.rs
index 797ead5b5626..2df0340e63d1 100644
--- a/rust/uapi/lib.rs
+++ b/rust/uapi/lib.rs
@@ -10,6 +10,7 @@
#![no_std]
#![allow(
clippy::all,
+ clippy::as_underscore,
clippy::cast_lossless,
clippy::ptr_as_ptr,
clippy::ref_as_ptr,
base-commit: 1676a4478e434d43f8cab79587becd16d3e86552
--
2.55.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::as_underscore` in the generated bindings
2026-09-06 21:58 [PATCH] rust: allow `clippy::as_underscore` in the generated bindings John Hubbard
@ 2026-09-06 22:48 ` Miguel Ojeda
2026-09-06 22:56 ` Miguel Ojeda
2026-09-06 23:10 ` Miguel Ojeda
1 sibling, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2026-09-06 22:48 UTC (permalink / raw)
To: John Hubbard
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, Greg Kroah-Hartman,
rust-for-linux, LKML
On Sun, Sep 6, 2026 at 11:58 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> A CLIPPY=1 build emitted about 15000 `as _` conversion warnings, all of
> them in bindgen's generated output and none in hand-written code.
>
> bindgen 0.73 returns each bitfield read through a trailing `as _`, and
> 0.72 returns it through a transmute, which the lint ignores. The
> bindings and uapi crates allow `clippy::all` over the generated code.
> That group does not cover `clippy::as_underscore`, a restriction lint.
>
> The minimum supported bindgen is 0.71.1, and 0.72 does not emit the
> cast, so upstream CI may not see these warnings yet.
>
> Allow `clippy::as_underscore` by name in the bindings and uapi crates.
>
> Assisted-by: LLM
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Thanks! Looks good to me.
We have been getting 0.73.0 and 0.73.1 fixed for a correctness issue I
noticed and I didn't see these yet -- I definitely recommend avoiding
those versions for kernel builds.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::as_underscore` in the generated bindings
2026-09-06 22:48 ` Miguel Ojeda
@ 2026-09-06 22:56 ` Miguel Ojeda
2026-09-06 23:01 ` John Hubbard
0 siblings, 1 reply; 5+ messages in thread
From: Miguel Ojeda @ 2026-09-06 22:56 UTC (permalink / raw)
To: John Hubbard
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, Greg Kroah-Hartman,
rust-for-linux, LKML, Emilio Cobos Álvarez
On Mon, Sep 7, 2026 at 12:48 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> Thanks! Looks good to me.
>
> We have been getting 0.73.0 and 0.73.1 fixed for a correctness issue I
> noticed and I didn't see these yet -- I definitely recommend avoiding
> those versions for kernel builds.
And by "we" I mean mostly Emilio (Cc'd :).
By the way, what do you mean by:
The minimum supported bindgen is 0.71.1, and 0.72 does not emit the
cast, so upstream CI may not see these warnings yet.
? i.e. what is the "upstream CI"? I am not sure which one is the base
commit either, so perhaps this is about some CI in DRM or similar? In
any case, I think I will remove that bit from the message since I am
not sure what it is meant to add, but if I am missing something,
please let me know!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::as_underscore` in the generated bindings
2026-09-06 22:56 ` Miguel Ojeda
@ 2026-09-06 23:01 ` John Hubbard
0 siblings, 0 replies; 5+ messages in thread
From: John Hubbard @ 2026-09-06 23:01 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, Greg Kroah-Hartman,
rust-for-linux, LKML, Emilio Cobos Álvarez
On 9/6/26 3:56 PM, Miguel Ojeda wrote:
> On Mon, Sep 7, 2026 at 12:48 AM Miguel Ojeda
> <miguel.ojeda.sandonis@gmail.com> wrote:
>>
>> Thanks! Looks good to me.
>>
>> We have been getting 0.73.0 and 0.73.1 fixed for a correctness issue I
>> noticed and I didn't see these yet -- I definitely recommend avoiding
>> those versions for kernel builds.
Arch Linux, always grabbing something new, for better or worse, here. :)
>
> And by "we" I mean mostly Emilio (Cc'd :).
>
> By the way, what do you mean by:
>
> The minimum supported bindgen is 0.71.1, and 0.72 does not emit the
> cast, so upstream CI may not see these warnings yet.
>
> ? i.e. what is the "upstream CI"? I am not sure which one is the base
> commit either, so perhaps this is about some CI in DRM or similar? In
That's just me guessing about how this was overlooked. Yes, go ahead
and remove it.
> any case, I think I will remove that bit from the message since I am
> not sure what it is meant to add, but if I am missing something,
> please let me know!
>
> Cheers,
> Miguel
thanks,
--
John Hubbard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: allow `clippy::as_underscore` in the generated bindings
2026-09-06 21:58 [PATCH] rust: allow `clippy::as_underscore` in the generated bindings John Hubbard
2026-09-06 22:48 ` Miguel Ojeda
@ 2026-09-06 23:10 ` Miguel Ojeda
1 sibling, 0 replies; 5+ messages in thread
From: Miguel Ojeda @ 2026-09-06 23:10 UTC (permalink / raw)
To: John Hubbard
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, Greg Kroah-Hartman,
rust-for-linux, LKML
On Sun, Sep 6, 2026 at 11:58 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> A CLIPPY=1 build emitted about 15000 `as _` conversion warnings, all of
> them in bindgen's generated output and none in hand-written code.
>
> bindgen 0.73 returns each bitfield read through a trailing `as _`, and
> 0.72 returns it through a transmute, which the lint ignores. The
> bindings and uapi crates allow `clippy::all` over the generated code.
> That group does not cover `clippy::as_underscore`, a restriction lint.
>
> The minimum supported bindgen is 0.71.1, and 0.72 does not emit the
> cast, so upstream CI may not see these warnings yet.
>
> Allow `clippy::as_underscore` by name in the bindings and uapi crates.
>
> Assisted-by: LLM
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Applied to `rust-fixes` so that we get it into linux-next since this
sort of thing can be quite annoying -- thanks!
[ The lint messages look like:
error: using `as _` conversion
--> rust/bindings/bindings_generated.rs:18947:9
|
18947 | self._bitfield_1.get_const::<0usize, 16u8>() as u32 as _
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
| |
|
help: consider giving the type explicitly: `u32`
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#as_underscore
= note: `-D clippy::as-underscore` implied by `-D warnings`
= help: to override `-D warnings` add
`#[allow(clippy::as_underscore)]`
- Miguel ]
[ Removed CI sentence. - Miguel ]
Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is
pinned in older LTSs).
Technically it is not needed in 6.12.y since the lint is not enabled,
but it doesn't hurt, may help downstream trees and may simplify future
backports.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-06 23:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 21:58 [PATCH] rust: allow `clippy::as_underscore` in the generated bindings John Hubbard
2026-09-06 22:48 ` Miguel Ojeda
2026-09-06 22:56 ` Miguel Ojeda
2026-09-06 23:01 ` John Hubbard
2026-09-06 23:10 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®