Description
Link to Zulip Discussion.
Right now Vec
provides no guarantees wrt structural pinning, meaning if we have a Vec
of futures and we pin project through it, it works fine today - but we're not guaranteed it will continue to work fine tomorrow. For example, futures::join_all!
notes internally that:
Safety:
std
could make this unsound if it were to decide Pin's invariants aren't required to transmit through slices. Otherwise this has the same safety as a normal field pin projection.
Those are pretty shaky grounds to build on, and it'd be better if we could actually guarantee that this will continue to work fine in the future. Especially as the Async WG is looking to fold facilities akin to join_all!
into the stdlib. I'm not sure what exactly we'd need to document in order to make these guarantees, hence this issue.
Tagging in: @rust-lang/wg-async, @rust-lang/wg-unsafe-code-guidelines, and also @RalfJung specifically since they've been working on the intersection of soundness and pinning recently.