Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 733 Bytes

bounding_async_drop.md

File metadata and controls

13 lines (9 loc) · 733 Bytes

Bounding async drop

As a special case of the bounding futures problem, we must consider AsyncDrop.

async fn foo<T>(t: T) {
    runtime::sleep(22).await;
}

The type of foo(t) is going to be a future type like FooFuture<T>. This type will also include the types of all futures that get awaited (e.g., the return value of runtime::sleep(22) in this case). But in the case of T, we don't yet know what T is, and if it should happen to implement AsyncDrop, then there is an "implicit await" of that future. We have to ensure that the contents of that future are taken into account when we determine if FooFuture<T>: Send.