Open ennis opened 3 weeks ago
Right, there is currently no stable way to do that. https://rust-lang.github.io/rfcs/3621-derive-smart-pointer.html might be stabilized at some point and then we'd be able to do it.
In the mean time you need to coerce the Rc:
Something like:
weak.upgrade().map_or(PinWeak<dyn core::any::Any>::default(), |x| PinWeak::<dyn core::any::Any>::downgrade(x))
Currently this fails to compile:
whereas the std::rc::Weak version compiles (playground link)
I'm not sure if it's possible without CoerceUnsized which is not stabilized.