summaryrefslogtreecommitdiffstats
path: root/tests/ui/impl-trait/async_scope_creep.rs
blob: 7a9d64d339feb1531a526092d0f2b53616c862e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#![feature(type_alias_impl_trait)]
// edition:2021
// check-pass

struct Pending {}

struct CantOpen {}

trait AsyncRead {}

impl AsyncRead for i32 {}

type PendingReader<'a> = impl AsyncRead + 'a;

type OpeningReadFuture<'a> =
    impl std::future::Future<Output = Result<PendingReader<'a>, CantOpen>>;

impl Pending {
    async fn read(&mut self) -> Result<impl AsyncRead + '_, CantOpen> {
        Ok(42)
    }

    fn read_fut(&mut self) -> OpeningReadFuture<'_> {
        self.read()
    }
}

fn main() {}