]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/issues/issue-93788.rs
Merge commit '266e96785ab71834b917bf474f130a6d8fdecd4b' into sync_cg_clif-2022-10-23
[rust.git] / src / test / ui / impl-trait / issues / issue-93788.rs
1 // check-pass
2
3 struct D;
4
5 trait Tr {
6     type It;
7     fn foo(self) -> Option<Self::It>;
8 }
9
10 impl<'a> Tr for &'a D {
11     type It = ();
12     fn foo(self) -> Option<()> { None }
13 }
14
15 fn run<F>(f: F)
16     where for<'a> &'a D: Tr,
17           F: Fn(<&D as Tr>::It),
18 {
19     let d = &D;
20     while let Some(i) = d.foo() {
21         f(i);
22     }
23 }
24
25 fn main() {
26     run(|_| {});
27 }