-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE with "Encountered error `OutputTypeParameterMismatch" on stable rust #80291
Comments
if the trait bound on F1 is changed and a lifetime added, then the ICA disappears: trait ColumnOutput<'a, T> {
type Output: Sized;
}
struct C;
impl<'a, T> ColumnOutput<'a, T> for C {
type Output = T;
}
fn calc<'a, T1: Default, T2, O1, O2, F1>(f: F1)
where
O1: ColumnOutput<'a, T1>,
O2: ColumnOutput<'a, T2>,
F1: Fn(&<O2 as ColumnOutput<'a, T2>>::Output) -> T1, //Lifetime added
{
let c2_data: Vec<<O2 as ColumnOutput<T2>>::Output> = Vec::new();
let mut dummy: Vec<T1> = Vec::new();
dummy.extend(c2_data.iter().map(|c2_value| f(c2_value)));
}
pub fn run_calc() {
calc::<u64, u64, C, C, _>(|c2_data| *c2_data)
}
fn main() {
run_calc();
} |
Minimized: trait ColumnOutput<'a> {
type Output;
}
struct C {}
impl<'a> ColumnOutput<'a> for C {
type Output = u64;
}
fn calc<'a, O, F>(f: F)
where
O: ColumnOutput<'a>,
F: Fn(<O as ColumnOutput>::Output) -> u64,
{
f(vec![].pop().unwrap());
}
fn main() {
calc::<C, _>(|_| unimplemented!());
} |
I think the issue is that the lifetime of |
AFAIK |
Issue: rust-lang/rust#80291
Fixed by #85499, closing since lots of added tests cover this pattern |
I have encountered an ICE in stable rust, please see the code and error below. The issue seems to be present also on nightly and also older rust compiler versions like 1.45.
Code
Meta
The ICE happens also on nightly
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: