Am I facing a HRTB bug?
trait Variable<'a> {
type Type;
}
impl Variable<'_> for () {
type Type = ();
}
fn check<F, T>(f: F)
where
F: Fn(T),
F: for<'a> Fn(<T as Variable<'a>>::Type),
T: for<'a> Variable<'a>,
{
}
fn main() {
fn fn_test(_: ()) {}
check(fn_test);
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0631]: type mismatch in function arguments
--> src/lib.rs:19:11
|
18 | fn fn_test(_: ()) {}
| ----------------- found signature of `fn(()) -> _`
19 | check(fn_test);
| ----- ^^^^^^^ expected signature of `for<'a> fn(<() as Variable<'a>>::Type) -> _`
| |
| required by a bound introduced by this call
|
note: required by a bound in `check`
--> src/lib.rs:12:8
|
9 | fn check<F, T>(f: F)
| ----- required by a bound in this
...
12 | F: for<'a> Fn(<T as Variable<'a>>::Type),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check`
For more information about this error, try `rustc --explain E0631`.
error: could not compile `playground` due to previous error