Open
Description
Given the following code (playground):
struct Foo<T>(T);
fn main() {
|| {
if false {
return Foo(0);
}
Foo(())
};
}
The current output is:
error[E0308]: mismatched types
--> src/main.rs:9:13
|
9 | Foo(())
| ^^ expected integer, found `()`
Ideally the output should look like:
error[E0308]: mismatched types
--> src/main.rs:9:13
|
9 | Foo(())
| ^^ expected integer, found `()`
|
note: return type inferred to be `Foo<{integer}>` here
--> src/main.rs:6:20
|
6 | return Foo(0);
| ^^^^^^
Since #78235, notes have been provided when the returned types are entirely different—but they do not appear when they are the same base type with different generic type parameters. cc @Aaron1011
@rustbot label: A-closures A-diagnostics A-inference C-enhancement D-papercut