-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.T-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.
Description
Given the following code:
fn bar<Input>() -> impl Fn(Input) {
|i| todo!()
}
fn foo() -> impl Fn(&str) {
bar()
}
The current output is:
error[E0308]: mismatched types
--> src/lib.rs:5:13
|
1 | fn bar<Input>() -> impl Fn(Input) {
| --------------
| |
| the expected opaque type
| the found opaque type
...
5 | fn foo() -> impl Fn(&str) {
| ^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected associated type `<impl Fn<(&str,)> as FnOnce<(&str,)>>::Output`
found associated type `<impl Fn<(&str,)> as FnOnce<(&str,)>>::Output`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` due to previous error
It seems like a bug that the "expected" and "found" types are the same.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.T-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.