Could Arc have Arc::aliased that would behave like C++ shared_ptr's aliasing constructor?

Returning Arc<U> also has the problem that you no longer know how to drop T statically, so you're going to need to have a dyn drop vtable for T if you want to drop it. If you aren't borrowing from T, it reduces to just (Arc<dyn Destruct>, U).

If you are, it becomes annoyingly difficult, fast, and is essentially the "self referential" problem.

With this signature, very much no; you're allowing the caller to choose whatever 'a they want. (I choose 'static. :slightly_smiling_face:)

The complexity of a properly sound API is nearly irreducible from yoke. I should know; I tried and failed. The real insidious soundness hole that is difficult to patch effectively is variance.

(...I really need to get around to yanking that crate, given it's unsound...)

3 Likes