1 // Regression test for #75777.
2 // Checks that a boxed future can be properly constructed.
4 #![feature(future_readiness_fns)]
6 use std::future::{self, Future};
9 type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a + Send>>;
11 fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
12 let fut: BoxFuture<'a, A> = Box::pin(future::ready(v));
13 Box::new(move |_| fut)
14 //~^ ERROR: cannot infer an appropriate lifetime