]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-75777.rs
Rollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514
[rust.git] / src / test / ui / issues / issue-75777.rs
1 // Regression test for #75777.
2 // Checks that a boxed future can be properly constructed.
3
4 #![feature(future_readiness_fns)]
5
6 use std::future::{self, Future};
7 use std::pin::Pin;
8
9 type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a + Send>>;
10
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
15 }
16
17 fn main() {}