6 task::{Context, Poll, Waker},
9 pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
13 impl<F> Future for StructAsync<F>
15 F: Fn() -> Pin<Box<dyn Future<Output = ()>>>,
19 fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> {
24 async fn callback() {}
28 fn waker() -> &'static Waker {
34 pub fn block_on<F: Future>(&self, mut future: F) -> F::Output {
37 Pin::new_unchecked(&mut future).poll(&mut Context::from_waker(waker()));
44 Runtime.block_on(async {
45 StructAsync { callback }.await;
46 //~^ ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
47 //~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
48 //~| ERROR expected `fn() -> impl Future<Output = ()> {callback}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`