]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/box-future-wrong-output.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / suggestions / box-future-wrong-output.rs
1 // Issue #72117
2 // edition:2018
3
4 use core::future::Future;
5 use core::pin::Pin;
6
7 pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
8
9 impl<T: ?Sized> FutureExt for T where T: Future {}
10 trait FutureExt: Future {
11     fn boxed<'a>(self) -> BoxFuture<'a, Self::Output>
12     where
13         Self: Sized + Send + 'a,
14     {
15         Box::pin(self)
16     }
17 }
18
19 fn main() {
20     let _: BoxFuture<'static, bool> = async {}.boxed();
21     //~^ ERROR: mismatched types
22 }