-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-codegenArea: Code generationArea: Code generationA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
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)
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-codegenArea: Code generationArea: Code generationA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.