]> git.lizzy.rs Git - rust.git/blob - tests/ui/anonymous-higher-ranked-lifetime.rs
Rollup merge of #107576 - P1n3appl3:master, r=tmandry
[rust.git] / tests / ui / anonymous-higher-ranked-lifetime.rs
1 fn main() {
2     f1(|_: (), _: ()| {}); //~ ERROR type mismatch
3     f2(|_: (), _: ()| {}); //~ ERROR type mismatch
4     f3(|_: (), _: ()| {}); //~ ERROR type mismatch
5     f4(|_: (), _: ()| {}); //~ ERROR type mismatch
6     f5(|_: (), _: ()| {}); //~ ERROR type mismatch
7     g1(|_: (), _: ()| {}); //~ ERROR type mismatch
8     g2(|_: (), _: ()| {}); //~ ERROR type mismatch
9     g3(|_: (), _: ()| {}); //~ ERROR type mismatch
10     g4(|_: (), _: ()| {}); //~ ERROR type mismatch
11     h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
12     h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
13 }
14
15 // Basic
16 fn f1<F>(_: F) where F: Fn(&(), &()) {}
17 fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
18 fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
19 fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
20 fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
21
22 // Nested
23 fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
24 fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
25 fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
26 fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
27
28 // Mixed
29 fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
30 fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}