]> git.lizzy.rs Git - rust.git/blob - tests/ui/trait-bounds/issue-95640.rs
Rollup merge of #106664 - chenyukang:yukang/fix-106597-remove-lseek, r=cuviper
[rust.git] / tests / ui / trait-bounds / issue-95640.rs
1 // build-pass
2 // compile-flags:-Zmir-opt-level=3
3
4 struct D;
5
6 trait Tr {
7     type It;
8     fn foo(self) -> Option<Self::It>;
9 }
10
11 impl<'a> Tr for &'a D {
12     type It = ();
13     fn foo(self) -> Option<()> {
14         None
15     }
16 }
17
18 fn run<F>(f: F)
19 where
20     for<'a> &'a D: Tr,
21     F: Fn(<&D as Tr>::It),
22 {
23     let d = &D;
24     while let Some(i) = d.foo() {
25         f(i);
26     }
27 }
28
29 fn main() {
30     run(|_| {});
31 }