summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generic-associated-types/bugs/issue-100013.rs
blob: fc4e47a3ba18881963003ef6274e597ff4b9256f (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
36
37
38
39
// check-fail
// known-bug
// edition: 2021

// We really should accept this, but we need implied bounds between the regions
// in a generator interior.

pub trait FutureIterator {
    type Future<'s, 'cx>: Send
    where
        's: 'cx;
}

fn call<I: FutureIterator>() -> impl Send {
    async { // a generator checked for autotrait impl `Send`
        //~^ lifetime bound not satisfied
        let x = None::<I::Future<'_, '_>>; // a type referencing GAT
        async {}.await; // a yield point
    }
}

fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
    async { // a generator checked for autotrait impl `Send`
        //~^ lifetime bound not satisfied
        let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
        //~^ lifetime may not live long enough
        async {}.await; // a yield point
    }
}

fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
    async { // a generator checked for autotrait impl `Send`
        //~^ lifetime bound not satisfied
        let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
        async {}.await; // a yield point
    }
}

fn main() {}