Link to Play
If uncomment code rust say that Future cannot be unpinned. it seems that there should be some kind of trick that will allow you not to make an additional allocation.
select_ok in futures::future - Rust requires that the future implement Unpin. But the anonymous type created by async functions implement !Unpin. The only solution is to use Box.
Imagine that Drop for Vec was implemented by doing vec.into_iter().for_each(drop). This first moves the Futures and only after that it drops them. This would break the Pin guarantee since the Futures were moved before dropping it!
No, the vector is the one that drops the Futures.
This is true but it doesn't prevent the issue: when the Vec is automatically dropped at the end of the scope it could do anything to the contained Futures, potentially breaking the Pin guarantees.
Ideally, there'd be something like impl IntoIterator<Item=Pin<&'a mut T>> for Pin<&'a mut [T]> in the standard library to remove the need for explicit unsafe here, but I couldn't find one.