Relative Pointer: an abstraction to build movable self-referential types

I'm pretty sure that with #[repr(packed)] they can :grimacing:

Yes of course, but your current interface is the one of a *mut T, so it should be inited by a &mut T. You would gain some extra benefits, also. By taking a &mut _, you could be sure that the offset is non zero and use NonZeroI8. You could then wrap it into an Option and thus be able to keep track of its initialised state, or just let users do that, and get enum layout optimization :slight_smile:

One question remains, though: @RalfJung how come ::core::ptr::NonNull<T>, which has .as_mut() implements From<&'_ T>? Shouldn't there at least be some warning in the documentation against the combination of the two?