[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ-ks9m33v4WddztHWOgCkBWuO0RdfbE8iZKj+1EJ+YBLaGyZQ@mail.gmail.com>
Date: Fri, 8 Nov 2024 07:53:28 -0500
From: Tamir Duberstein <tamird@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/6] rust: arc: split unsafe block, add missing comment
On Fri, Nov 8, 2024 at 7:47 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> On Fri, Nov 8, 2024 at 1:41 PM Tamir Duberstein <tamird@...il.com> wrote:
> >
> > On Fri, Nov 8, 2024 at 7:37 AM Alice Ryhl <aliceryhl@...gle.com> 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
Powered by blists - more mailing lists