[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230116220736.6d5c8ea3.gary@garyguo.net>
Date: Mon, 16 Jan 2023 22:07:36 +0000
From: Gary Guo <gary@...yguo.net>
To: Emilio Cobos Álvarez <emilio@...sal.io>
Cc: Wedson Almeida Filho <wedsonaf@...il.com>,
rust-for-linux@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/7] rust: sync: introduce `ArcBorrow`
On Wed, 4 Jan 2023 17:06:50 +0100
Emilio Cobos Álvarez <emilio@...sal.io> wrote:
> Sorry for the drive-by comment, but maybe it saves some work.
>
> On 1/4/23 16:29, Wedson Almeida Filho wrote:
> > On Sat, 31 Dec 2022 at 19:43, Gary Guo <gary@...yguo.net> wrote:
> >>
> >> On Wed, 28 Dec 2022 06:03:43 +0000
> >> Wedson Almeida Filho <wedsonaf@...il.com> wrote:
> >>> +pub struct ArcBorrow<'a, T: ?Sized + 'a> {
> >>> + inner: NonNull<ArcInner<T>>,
> >>> + _p: PhantomData<&'a ()>,
> >>> +}
> >>> +
> >>> +impl<T: ?Sized> Clone for ArcBorrow<'_, T> {
> >>> + fn clone(&self) -> Self {
> >>> + *self
> >>> + }
> >>> +}
> >>> +
> >>> +impl<T: ?Sized> Copy for ArcBorrow<'_, T> {}
> >>
> >> Couldn't this just be derived `Clone` and `Copy`?
> >
> > Indeed. I'll send a v2 with this.
>
> I'm not sure this is true. Deriving will add the T: Copy and T: Clone
> bound, which I think is not what you want here.
>
> i.e., I assume you want an ArcBorrow to be Copy even if the underlying T
> is not.
Thanks for pointing out, I neglected that.
In this case:
Reviewed-by: Gary Guo <gary@...yguo.net>
Powered by blists - more mailing lists