Apologies if this is already reported somewhere; couldn't find it during a quick search.
Getting an internal compiler error for this code (playground):
pub trait MyTrait<'a> {
type Output: 'a;
fn gimme_value(&self) -> Self::Output;
}
pub struct MyStruct;
impl<'a> MyTrait<'a> for MyStruct {
type Output = &'a usize;
fn gimme_value(&self) -> Self::Output {
unimplemented!()
}
}
fn meow<T, F>(t: T, f: F)
where
T: for<'any> MyTrait<'any>,
F: for<'any2> Fn(<T as MyTrait<'any2>>::Output),
{
let v = t.gimme_value();
f(v);
}
fn main() {
let struc = MyStruct;
meow(struc, |foo| {
println!("{:?}", foo);
})
}
The error reads:
error: internal compiler error: src/librustc_infer/traits/codegen/mod.rs:61: Encountered error `OutputTypeParameterMismatch(Binder(<[closure@src/main.rs:26:17: 28:6] as std::ops::Fn<(<MyStruct as MyTrait<'_>>::Output,)>>), Binder(<[closure@src/main.rs:26:17: 28:6] as std::ops::Fn<(&usize,)>>), Sorts(ExpectedFound { expected: &usize, found: <MyStruct as MyTrait<'_>>::Output }))` selecting `Binder(<[closure@src/main.rs:26:17: 28:6] as std::ops::Fn<(&usize,)>>)` during codegen
Tested in 1.42.0, 1.43.0-beta.1, and 1.44.0-nightly (2020-03-17 7ceebd98c6a15ae30e77)
Apologies if this is already reported somewhere; couldn't find it during a quick search.
Getting an internal compiler error for this code (playground):
The error reads:
Tested in
1.42.0,1.43.0-beta.1, and1.44.0-nightly (2020-03-17 7ceebd98c6a15ae30e77)