Stream: wg-async-foundations

Topic: ucg implications


nikomatsakis (Jul 08 2019 at 18:52, on Zulip):

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.

nikomatsakis (Jul 08 2019 at 18:53, on Zulip):

Also cc @WG-unsafe-code-guidelines

Christopher Durham (Jul 08 2019 at 20:33, on Zulip):

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. map_unchecked).

RalfJ (Jul 10 2019 at 06:54, on Zulip):

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 map_unchecked*)

RalfJ (Jul 10 2019 at 06:54, on Zulip):

I can give further details if you want.... after Thursday ;)

RalfJ (Jul 13 2019 at 07:42, on Zulip):

@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.

nikomatsakis (Jul 13 2019 at 12:04, on Zulip):

I think you did, yes. It seems like we should not let it block stabilization to me. :)

nikomatsakis (Jul 13 2019 at 12:04, on Zulip):

But it will be something to sort out.

Last update: Nov 18 2019 at 00:40UTC