On Thu, 19 Oct 2023 at 21:31, Boqun Feng <boqun.feng@xxxxxxxxx> wrote: > On Wed, Oct 18, 2023 at 09:25:05AM -0300, Wedson Almeida Filho wrote: > > + // SAFETY: We are manually destructuring `self` and preventing `drop` from being called. > > + Ok(unsafe { (&ManuallyDrop::new(self).0 as *const ARef<INode<T>>).read() }) > > How do we feel about using transmute here? ;-) I.e. > > // SAFETY: `NewINode` is transparent to `ARef<INode<_>>`, and > // the inode has been initialised, so it's safety to change the > // object type. > Ok(unsafe { core::mem::transmute(self) }) > > What we actually want here is changing the type of the object (i.e. > bitwise move from one type to another), seems to me that transmute is > the best fit here. > > Thoughts? That's much nicer. I'll do this in v2.