[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D8FX0ETYS1IR.2ZEPASOQMIOVW@proton.me>
Date: Fri, 14 Mar 2025 10:25:52 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Antonio Hickey <contact@...oniohickey.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] rust: clippy: disable `addr_of!`, `addr_of_mut!` macros
On Fri Mar 14, 2025 at 4:46 AM CET, Antonio Hickey wrote:
> With the `raw_ref_op` feature enabled we no longer want to
> allow use of `addr_of!` and `addr_of_mut!` macros.
>
> We instead want to use `&raw const` and `&raw mut` to get raw
> pointers to a place.
>
> Suggested-by: Benno Lossin <benno.lossin@...ton.me>
> Link: https://github.com/Rust-for-Linux/linux/issues/1148
> Signed-off-by: Antonio Hickey <contact@...oniohickey.com>
> ---
> .clippy.toml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/.clippy.toml b/.clippy.toml
> index 815c94732ed7..95c73959f039 100644
> --- a/.clippy.toml
> +++ b/.clippy.toml
> @@ -8,4 +8,8 @@ disallowed-macros = [
> # The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we simulate
> # it here, see: https://github.com/rust-lang/rust-clippy/issues/11303.
> { path = "kernel::dbg", reason = "the `dbg!` macro is intended as a debugging tool" },
> + # With `raw_ref_op` feature enabled we no longer want to allow use of `addr_of!`
> + # and `addr_of_mut!` macros, but instead use `&raw` or `&raw mut`.
> + { path = "core::ptr::addr_of_mut", reason = "use `&raw mut` instead `addr_of_mut!`" },
> + { path = "core::ptr::addr_of", reason = "use `&raw` instead `addr_of!`" },
> ]
This patch still needs to be done *after* the third one in order to
avoid warnings (since you're removing the usages of `addr_of[_mut]!` in
the next patch).
---
Cheers,
Benno
Powered by blists - more mailing lists