Hey @RalfJ -- I saw your comment on the async-await stabilization issue, and I was wondering if you could say just a bit more? In particular, I don't quite know if the concern you are raising is something somewhat inherent to having "self-referential futures" (i.e., to the intended uses for
Pin, as you somewhat suggest), or is something that is tied to some details of how we have implemented futures.
Also cc @WG-unsafe-code-guidelines
What it boils down to is that
Pin<&mut F> holds a mutable reference to some location. If that location has an internal mutable reference (allowed by the
Pin contract), then the simple rule of "only one mutable reference" dies. Importantly, the outer reference _is_ used between uses of the internal references, so all prior Stacked Borrows model would invalidate the internal reference upon manifesting the outer reference (in e.g.
Right, so basically it is inherent to self-referntial structs if the pointer to the struct is a reference.
If we still had
PinMut as a dedicated type, my proposal would have been to use
NonNull internally instead. Provide the same API but not actually "be" a reference. That would help (except for
I can give further details if you want.... after Thursday ;)
@nikomatsakis did I answer your question? It is not really tied to how we have implemented futures and more tied to how we have implemented
Pin, I would say.
I think you did, yes. It seems like we should not let it block stabilization to me. :)
But it will be something to sort out.