]> git.lizzy.rs Git - rust.git/blob - tests/ui/generic-associated-types/bugs/issue-100013.rs
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / generic-associated-types / bugs / issue-100013.rs
1 // check-fail
2 // known-bug
3 // edition: 2021
4
5 // We really should accept this, but we need implied bounds between the regions
6 // in a generator interior.
7
8 pub trait FutureIterator {
9     type Future<'s, 'cx>: Send
10     where
11         's: 'cx;
12 }
13
14 fn call<I: FutureIterator>() -> impl Send {
15     async { // a generator checked for autotrait impl `Send`
16         //~^ lifetime bound not satisfied
17         let x = None::<I::Future<'_, '_>>; // a type referencing GAT
18         async {}.await; // a yield point
19     }
20 }
21
22 fn call2<'a, 'b, I: FutureIterator>() -> impl Send {
23     async { // a generator checked for autotrait impl `Send`
24         //~^ lifetime bound not satisfied
25         let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
26         //~^ lifetime may not live long enough
27         async {}.await; // a yield point
28     }
29 }
30
31 fn call3<'a: 'b, 'b, I: FutureIterator>() -> impl Send {
32     async { // a generator checked for autotrait impl `Send`
33         //~^ lifetime bound not satisfied
34         let x = None::<I::Future<'a, 'b>>; // a type referencing GAT
35         async {}.await; // a yield point
36     }
37 }
38
39 fn main() {}