]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/async-reference-generality.rs
668df9ea7101d341724f10f97c06467972c6bf4b
[rustc.git] / tests / ui / borrowck / async-reference-generality.rs
1 // check-pass
2 // edition: 2021
3
4 use std::marker::PhantomData;
5
6 pub struct Struct<I, T>(PhantomData<fn() -> <Self as It>::Item>)
7 where
8 Self: It;
9
10 impl<I> It for Struct<I, I::Item>
11 where
12 I: It,
13 {
14 type Item = ();
15 }
16
17 pub trait It {
18 type Item;
19 }
20
21 fn f() -> impl Send {
22 async {
23 let _x = Struct::<Empty<&'static ()>, _>(PhantomData);
24 async {}.await;
25 }
26 }
27
28 pub struct Empty<T>(PhantomData<fn() -> T>);
29
30 impl<T> It for Empty<T> {
31 type Item = T;
32 }
33
34 fn main() {}