Messages in this thread |  | | Date | Sat, 31 Dec 2022 19:51:54 +0000 | From | Gary Guo <> | 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@me.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
|  |