Pin/Unpin was introduced as a prerequisite to adding async/await support to Rust. It allows safely polling a future that potentially has internal refererences to it's own state.
However, wouldn't introducing move-constructors to the language be a simpler solution? This way the future could be moved freely in memory after being polled, all the internal references being fixed by the move-constructor. For example:
async fn foo { /* ... */ }
async fn bar {
let future = foo();
poll_fn(|cx| future.poll(cx)).await;
// Now `future` might have internal references.
let boxed_future = Box::new(future);
// The future was moved to the heap, but the move-constructor
// took care of adjusting the internal references, so we can
// safely poll the future again.
boxed_future.await;
}
Surely this approach was contemplated, but ultimately rejected. Why?