]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/async_scope_creep.rs
Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix
[rust.git] / src / test / ui / impl-trait / async_scope_creep.rs
1 #![feature(type_alias_impl_trait)]
2 // edition:2021
3 // check-pass
4
5 struct Pending {}
6
7 struct CantOpen {}
8
9 trait AsyncRead {}
10
11 impl AsyncRead for i32 {}
12
13 type PendingReader<'a> = impl AsyncRead + 'a;
14
15 type OpeningReadFuture<'a> =
16     impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;
17
18 impl Pending {
19     async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
20         Ok(42)
21     }
22
23     fn read_fut(&mut self) -> OpeningReadFuture<'_> {
24         self.read()
25     }
26 }
27
28 fn main() {}