Re: [PATCH] rust: iommu: replace core::mem::zeroed with pin_init::zeroed

"Gary Guo" <[email protected]> Sun, 28 Jun 2026 18:34:49 +0100
Newsgroups dev.linux.lists.linux-kernel-mentees,dev.linux.lists.iommu,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Sun Jun 28, 2026 at 11:31 AM BST, Miguel Ojeda wrote:
> On Sat, Jun 27, 2026 at 10:35 AM Alexandre Courbot <[email protected]> wrote:
>>
>> Note that you can also use `..Zeroable::zeroed()` here since we are not
>> in const context. Not sure which one we prefer in this case, but I'd
>> personally err on the side of not referring to `pin_init` unless we are
>> dealing with a pinned object or need to because of a const requirement.
>
> That sounds reasonable -- Benno/Gary, any comments?

`Zeroable::zeroed()` should be preferred where possible. Currently init macros
also recognize and turn them into zero-init if used inside init macros --
outside init macros they don't matter, but in a future where const trait methods
are stable we would want to prefer `Zeroable::zeroed()` anyway.

Best,
Gary