Re: [PATCH] rust: retain pointer mut-ness in `container_of!`
From: Tamir Duberstein
Date: Wed Apr 09 2025 - 10:59:41 EST
On Wed, Apr 9, 2025 at 10:43 AM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
>
> Avoid casting the input pointer to `*const _`, allowing the output
> pointer to be `*mut` if the input is `*mut`. This allows a number of
> `*const` to `*mut` conversions to be removed at the cost of slightly
> worse ergonomics when the macro is used with a reference rather than a
> pointer; the only example of this was in the macro's own doctest.
>
> Reviewed-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
> ---
> This patch is extracted from 3 other series to reduce duplication.
Oops, forgot to include
Reviewed-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
from https://lore.kernel.org/all/87semhbncg.fsf@xxxxxxxxxx/. I hope
this is proper form!