Re: [PATCH 6/6] rust: hrtimer: Make HrTimer repr(transparent)
Andreas Hindborg <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-gfx,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
"Gary Guo" <[email protected]> writes: > On Tue Aug 25, 2026 at 1:16 PM BST, Andreas Hindborg wrote: >> From: FUJITA Tomonori <[email protected]> >> >> HrTimerCallbackContext acquires a &HrTimer<T> from a >> NonNull<HrTimer<T>> while a &mut HrTimer<T> can exist at the same >> time. This is sound only because HrTimer's sole field is >> Opaque<bindings::hrtimer>, which puts every byte behind an UnsafeCell. >> Adding a field to HrTimer that is not Opaque would make acquiring that >> shared reference unsound. > > HrTimerCallbackContext is removed in patch 4, though? > > Still worh preferring `#[repr(transparent)]` over `#[repr(C)]`, but the > motivation should be reworded and the comment on `HrTimer` should be removed. Yes, I was a little too fast when I added this patch. I'd like to keep it as well, but it needs some edits. Best regards, Andreas Hindborg