]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90875.rs
Rollup merge of #106670 - albertlarsan68:check-docs-in-pr-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / higher-rank-trait-bounds / normalize-under-binder / issue-90875.rs
1 // check-pass
2
3 trait Variable<'a> {
4     type Type;
5 }
6
7 impl Variable<'_> for () {
8     type Type = ();
9 }
10
11 fn check<F, T>(_: F)
12 where
13     F: Fn(T), // <- if removed, all fn_* then require type annotations
14     F: for<'a> Fn(<T as Variable<'a>>::Type),
15     T: for<'a> Variable<'a>,
16 {
17 }
18
19 fn test(arg: impl Fn(())) {
20     fn fn_1(_: ()) {}
21     let fn_2 = |_: ()| ();
22     let fn_3 = |a| fn_1(a);
23     let fn_4 = arg;
24
25     check(fn_1); // Error
26     check(fn_2); // Ok
27     check(fn_3); // Ok
28     check(fn_4); // Error
29 }
30
31 fn main() {}