Re: [PATCH v4 2/3] rust: miscdevice: add additional data to MiscDeviceRegistration

From: Benno Lossin
Date: Sat Jun 07 2025 - 15:06:12 EST


On Sat Jun 7, 2025 at 5:39 PM CEST, Christian Schrefl wrote:
> On 07.06.25 5:37 PM, Benno Lossin wrote:
>> On Sat Jun 7, 2025 at 1:34 PM CEST, Christian Schrefl wrote:
>>> Yeah I understand that its not UB, but to me it seems a bit fragile and opaque why it is allowed.
>>> That's what I meant by "a bit iffy".
>>
>> What's fragile about it? That someone could add a non-opaque field to
>> the struct? Or that one is not allowed to take an `&`?
>
> Yeah that a added field could cause UB seems bad to me.

Actually, I don't think it would be UB, since only the `data` field
would be borrowed mutably/immutably at the same time, but not the new
field.

---
Cheers,
Benno