summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs
blob: f6cbbf04d8264c24597fe34bf19a1fa499b93792 (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
29
// edition: 2021
// build-fail
//~^^ ERROR cycle detected when computing layout of

#![feature(impl_trait_in_assoc_type)]

use core::future::Future;

trait Recur {
    type Recur: Future<Output = ()>;

    fn recur(self) -> Self::Recur;
}

async fn recur(t: impl Recur) {
    t.recur().await;
}

impl Recur for () {
    type Recur = impl Future<Output = ()>;

    fn recur(self) -> Self::Recur {
        async move { recur(self).await; }
    }
}

fn main() {
    recur(());
}