1 // issue 65419 - Attempting to run an async fn after completion mentions generators when it should
2 // be talking about `async fn`s instead. Should also test what happens when it panics.
5 // error-pattern: thread 'main' panicked at '`async fn` resumed after panicking'
6 // compile-flags: --edition 2018
8 #![feature(generators, generator_trait)]
17 let mut future = Box::pin(foo());
18 panic::catch_unwind(panic::AssertUnwindSafe(|| {
19 executor::block_on(future.as_mut());
22 executor::block_on(future.as_mut());
29 task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
32 pub fn block_on<F: Future>(mut future: F) -> F::Output {
33 let mut future = unsafe { Pin::new_unchecked(&mut future) };
35 static VTABLE: RawWakerVTable = RawWakerVTable::new(
36 |_| unimplemented!("clone"),
37 |_| unimplemented!("wake"),
38 |_| unimplemented!("wake_by_ref"),
41 let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
42 let mut context = Context::from_waker(&waker);
45 if let Poll::Ready(val) = future.as_mut().poll(&mut context) {