From: "Gary Guo" <gary@garyguo.net>
To: "John Hubbard" <jhubbard@nvidia.com>, "Miguel Ojeda" <ojeda@kernel.org>
Cc: "Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
rust-for-linux@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] rust: allow `unknown_lints` in the generated bindings
Date: Sat, 12 Sep 2026 17:29:57 +0100 [thread overview]
Message-ID: <DLDHB99HCXCB.S9V6QLDVSW3N@garyguo.net> (raw)
In-Reply-To: <20260911195209.442715-1-jhubbard@nvidia.com>
On Fri Sep 11, 2026 at 8:52 PM BST, John Hubbard wrote:
> A build with bindgen 0.73.2 and the minimum supported rustc, 1.85.0,
> emits about 12000 `unknown_lints` warnings, all of them in bindgen's
> generated output. CONFIG_WERROR or W=e turns them into a failed build.
>
> Starting with 0.73.0, bindgen writes `#[allow(unnecessary_transmutes)]`
> onto every bitfield accessor and constructor it generates. It does so
> regardless of `--rust-target`, which rust/Makefile already sets to 1.85.
> That lint exists only since rustc 1.88.0.
>
> Commit 7129ea6e242b ("rust: clean Rust 1.88.0's `unnecessary_transmutes`
> lint") made the kernel's own attribute conditional, to keep
> `unknown_lints` enabled. That condition cannot be put on an attribute
> that bindgen writes.
>
> Allow `unknown_lints` in the bindings and uapi crates.
Already fixed: https://lore.kernel.org/rust-for-linux/CANiq72=fEYa1PygH-XJHONQKqf53dZFuGc-Z7wd4M7yeREq8Vw@mail.gmail.com/
Best,
Gary
>
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Assisted-by: LLM
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
> rust/bindings/lib.rs | 2 ++
> rust/uapi/lib.rs | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs
> index 812f8e5a08d5..a3af57d7d137 100644
> --- a/rust/bindings/lib.rs
> +++ b/rust/bindings/lib.rs
> @@ -26,6 +26,8 @@
> #[allow(clippy::ptr_as_ptr)]
> #[allow(clippy::ref_as_ptr)]
> #[allow(clippy::undocumented_unsafe_blocks)]
> +// `bindgen` emits `#[allow(...)]` for lints newer than the minimum supported `rustc`.
> +#[allow(unknown_lints)]
> #[cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]
> #[cfg_attr(
> CONFIG_RUSTC_HAS_SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS,
> diff --git a/rust/uapi/lib.rs b/rust/uapi/lib.rs
> index 797ead5b5626..361b490acc25 100644
> --- a/rust/uapi/lib.rs
> +++ b/rust/uapi/lib.rs
> @@ -23,6 +23,8 @@
> unreachable_pub,
> unsafe_op_in_unsafe_fn
> )]
> +// `bindgen` emits `#[allow(...)]` for lints newer than the minimum supported `rustc`.
> +#![allow(unknown_lints)]
> #![cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]
> #![cfg_attr(
> CONFIG_RUSTC_HAS_SUSPICIOUS_RUNTIME_SYMBOL_DEFINITIONS,
>
> base-commit: 3026c6e4f223bdded6448fefe53ff85d9cbe51bd
prev parent reply other threads:[~2026-09-12 16:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 19:52 [PATCH] rust: allow `unknown_lints` in the generated bindings John Hubbard
2026-09-12 16:29 ` Gary Guo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DLDHB99HCXCB.S9V6QLDVSW3N@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gregkh@linuxfoundation.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox