[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221231195154.24c07869.gary@garyguo.net>
Date: Sat, 31 Dec 2022 19:51:54 +0000
From: Gary Guo <gary@...yguo.net>
To: Laine Taffin Altman <alexanderaltman@...com>
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 7/7] rust: sync: add support for dispatching on Arc and
ArcBorrow.
On Tue, 27 Dec 2022 23:24:37 -0800
Laine Taffin Altman <alexanderaltman@...com> wrote:
> > +// This is to allow `ArcBorrow<U>` to be dispatched on when `ArcBorrow<T>` can be coerced into
> > +// `ArcBorrow<U>`.
> > +impl<T: ?Sized + Unsize<U>, U: ?Sized> core::ops::DispatchFromDyn<ArcBorrow<'_, U>>
> > + for ArcBorrow<'_, T>
>
> These lifetimes need to be tied together, I think.
> `impl<'a, T: ?Sized + Unsize<U> + 'a, U: ?Sized + 'a> core::ops::DispatchFromDyn<ArcBorrow<'a, U>> for ArcBorrow<'a, T>`
I don't think this is necessary, libcore has the following code
(https://doc.rust-lang.org/stable/src/core/ops/unsize.rs.html#123):
impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> core::ops::DispatchFromDyn<&'a U> for &'a T {}
which should be equivalent to Wedson's lifetime elided version.
Best,
Gary
Powered by blists - more mailing lists