4 #![feature(arbitrary_self_types)]
6 use std::task::{self, Poll};
7 use std::future::Future;
8 use std::marker::Unpin;
11 // This is a regression test for a ICE/unbounded recursion issue relating to async-await.
14 #[must_use = "futures do nothing unless polled"]
19 impl<F> Unpin for Lazy<F> {}
21 pub fn lazy<F, R>(f: F) -> Lazy<F>
22 where F: FnOnce(&mut task::Context) -> R,
27 impl<R, F> Future for Lazy<F>
28 where F: FnOnce(&mut task::Context) -> R,
32 fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context) -> Poll<R> {
33 Poll::Ready((self.f.take().unwrap())(cx))
37 async fn __receive<WantFn, Fut>(want: WantFn) -> ()
38 where Fut: Future<Output = ()>, WantFn: Fn(&Box<dyn Send + 'static>) -> Fut,
43 pub fn basic_spawn_receive() {
44 async { __receive(|_| async { () }).await };