On Tue, 16 Jun 2026 16:38:51 +0200 Philipp Stanner <[email protected]> wrote:
> On Tue, 2026-06-16 at 15:47 +0300, Onur Özkan wrote: > > On Tue, 16 Jun 2026 10:28:17 +0200 > > > + > > > + // DriverFenceData is repr(C) and a Fence is its first member. > > > + let fence_data_ptr = fence_ptr as *mut DriverFenceData<T>; > > > > Either the field ordering on the type or this code is wrong because the > > first > > member of DriverFenceData is `rcu_head`. > > Yeah, that's a bug introduced in this revision. Thx for pointing it > out. Already fixed it downstream. > > I'm just wondering why my test did not blow up. > > > > > > > +} > > > > I am unsure whether it is safe to cast the pointer in Fence::from_raw > > without > > Fence being #[repr(transparent)] as the layout compatibility is not > > guaranteed > > explicitly. > > Shouldn't #[repr(C)] do that trick, too? Do you need both? > > Who can answer that? > > > P. You shouldn't use both and I think it wouldn't compile anyway. repr(C) only makes sense when the type have multiple fields. Thanks, Onur

