1 // Regression test for #75777.
2 // Checks that a boxed future can be properly constructed.
4 use std::future::{self, Future};
7 type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a + Send>>;
9 fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box<dyn FnOnce(&'a Env) -> BoxFuture<'a, A>> {
10 let fut: BoxFuture<'a, A> = Box::pin(future::ready(v));
11 Box::new(move |_| fut)
12 //~^ ERROR: lifetime may not live long enough