Closed lcnr closed 4 months ago
likely caused by closure signature inference
#![allow(unused)]
trait HigherRanked {
type Output<'a>;
}
trait Id {
type Refl: HigherRanked;
}
fn foo<T: Id>() -> for<'a> fn(<<T as Id>::Refl as HigherRanked>::Output<'a>) {
todo!()
}
fn bar<T: Id>() {
// generalize here:
let x = foo::<T>();
}
fn main() {}
not caused by closure signature inference: if the outer alias refernces a bound var, the generalizer recurses into it, but then if the nested alias does not refer to bound vars, it gets replaced with an inference variable:
We generalize for<'a> fn(<<T as Id>::Refl as HigherRanked>::Output<'a>)
to for<'a> fn(<?new as HigherRanked>::Output<'a>)