Messages in this thread | | | Date | Mon, 16 Jan 2023 22:07:36 +0000 | From | Gary Guo <> | Subject | Re: [PATCH 4/7] rust: sync: introduce `ArcBorrow` |
| |
On Wed, 4 Jan 2023 17:06:50 +0100 Emilio Cobos Álvarez <emilio@crisal.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@garyguo.net> wrote: > >> > >> On Wed, 28 Dec 2022 06:03:43 +0000 > >> Wedson Almeida Filho <wedsonaf@gmail.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@garyguo.net>
| |