]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/async-reference-generality.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / async-reference-generality.rs
1 // check-fail
2 // known-bug: #99492
3 // edition: 2021
4
5 use std::marker::PhantomData;
6
7 pub struct Struct<I, T>(PhantomData<fn() -> <Self as It>::Item>)
8 where
9     Self: It;
10
11 impl<I> It for Struct<I, I::Item>
12 where
13     I: It,
14 {
15     type Item = ();
16 }
17
18 pub trait It {
19     type Item;
20 }
21
22 fn f() -> impl Send {
23     async {
24         let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
25         async {}.await;
26     }
27 }
28
29 pub struct Empty<T>(PhantomData<fn() -> T>);
30
31 impl<T> It for Empty<T> {
32     type Item = T;
33 }
34
35 fn main() {}