diff --git a/tests/all/async_functions.rs b/tests/all/async_functions.rs index 7d8a389b31..f2c5e74ec7 100644 --- a/tests/all/async_functions.rs +++ b/tests/all/async_functions.rs @@ -269,6 +269,9 @@ async fn cancel_during_run() { *caller.data_mut() = 1; let dtor = SetOnDrop(caller); Box::new(async move { + // SetOnDrop is not destroyed when dropping the reference of it + // here. Instead, it is moved into the future where it's forced + // to live in and will be destroyed at the end of the future. drop(&dtor); tokio::task::yield_now().await; Ok(())