Re: [PATCH v2 3/6] rust: arc: split unsafe block, add missing comment

From: Tamir Duberstein
Date: Fri Nov 08 2024 - 07:54:15 EST


On Fri, Nov 8, 2024 at 7:47 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> On Fri, Nov 8, 2024 at 1:41 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> >
> > On Fri, Nov 8, 2024 at 7:37 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> > > You could write `unsafe { (*self.ptr.as_ptr()).refcount.get() }` to
> > > avoid the as_ref call.
> >
> > Doesn't `(*self.ptr.as_ptr())` have the same problem?
>
> It's not quite the same. Both `*ptr` and `(*ptr).field` are place
> expressions which do not inherently involve the creation of a
> reference in the way that `NonNull::as_ref` does.

Thanks for explaining!
Tamir