Re: [PATCH] rust: bitmap: clean Rust 1.92.0 `unused_unsafe` warning
From: Alice Ryhl
Date: Tue Oct 14 2025 - 12:21:53 EST
On Tue, Oct 14, 2025 at 12:09:09PM -0400, Yury Norov wrote:
> On Mon, Oct 13, 2025 at 09:20:15AM +0000, Alice Ryhl wrote:
> > On Mon, Oct 13, 2025 at 02:14:22AM +0200, Miguel Ojeda wrote:
> > > Starting with Rust 1.92.0 (expected 2025-12-11), Rust allows to safely
> > > take the address of a union field [1][2]:
> > >
> > > CLIPPY L rust/kernel.o
> > > error: unnecessary `unsafe` block
> > > --> rust/kernel/bitmap.rs:169:13
> > > |
> > > 169 | unsafe { core::ptr::addr_of!(self.repr.bitmap) }
> > > | ^^^^^^ unnecessary `unsafe` block
> > > |
> > > = note: `-D unused-unsafe` implied by `-D warnings`
> > > = help: to override `-D warnings` add `#[allow(unused_unsafe)]`
> > >
> > > error: unnecessary `unsafe` block
> > > --> rust/kernel/bitmap.rs:185:13
> > > |
> > > 185 | unsafe { core::ptr::addr_of_mut!(self.repr.bitmap) }
> > > | ^^^^^^ unnecessary `unsafe` block
> > >
> > > Thus allow both instances to clean the warning in newer compilers.
> > >
> > > Link: https://github.com/rust-lang/rust/issues/141264 [1]
> > > Link: https://github.com/rust-lang/rust/pull/141469 [2]
> > > Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
> >
> > Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
> Added in bitmap-for-next.
Is there any possibility of landing this for an -rc of 6.18 instead of
for 6.19-rc1? That way, the warning won't be present when compiling 6.18
with rustc 1.92.0 and newer.
Alice