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

From: Gary Guo

Date: Sun Jun 28 2026 - 13:35:08 EST


On Sun Jun 28, 2026 at 11:31 AM BST, Miguel Ojeda wrote:
> On Sat, Jun 27, 2026 at 10:35 AM Alexandre Courbot <acourbot@xxxxxxxxxx> 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