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'
7 // ignore-wasm no panic or subprocess support
8 // ignore-emscripten no panic or subprocess support
10 #![feature(generators, generator_trait)]
19 let mut future
= Box
::pin(foo());
20 panic
::catch_unwind(panic
::AssertUnwindSafe(|| {
21 executor
::block_on(future
.as_mut());
24 executor
::block_on(future
.as_mut());
31 task
::{Context, Poll, RawWaker, RawWakerVTable, Waker}
,
34 pub fn block_on
<F
: Future
>(mut future
: F
) -> F
::Output
{
35 let mut future
= unsafe { Pin::new_unchecked(&mut future) }
;
37 static VTABLE
: RawWakerVTable
= RawWakerVTable
::new(
38 |_
| unimplemented
!("clone"),
39 |_
| unimplemented
!("wake"),
40 |_
| unimplemented
!("wake_by_ref"),
43 let waker
= unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) }
;
44 let mut context
= Context
::from_waker(&waker
);
47 if let Poll
::Ready(val
) = future
.as_mut().poll(&mut context
) {