about summary refs log tree commit diff
path: root/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs
blob: b25d8a34aca1c4ff7d87a99d4a0328b0b69f8461 (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
30
31
32
33
34
35
//@ edition: 2021

fn main() {
    let _ = async {
        A.first().await.second().await;
    };
}

pub trait First {
    type Second: Second;
    async fn first(self) -> Self::Second;
}

struct A;

impl First for A {
    type Second = A;
    async fn first(self) -> Self::Second {
        A
    }
}

pub trait Second {
    async fn second(self);
}

impl<C> Second for C
where
    C: First,
{
    async fn second(self) {
        //~^ ERROR recursion in an async fn requires boxing
        self.first().await.second().await;
    }
}