On FnDef type annotation suggestion, use fn-pointer output

Partly addresses #71209.
This commit is contained in:
Esteban Küber 2020-04-18 20:51:11 -07:00
parent 52fa23add6
commit c47bb6debd
3 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,5 @@
fn f<A>() -> A { unimplemented!() }
fn foo() {
let _ = f; //~ ERROR type annotations needed for `fn() -> A`
}
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0282]: type annotations needed for `fn() -> A`
--> $DIR/fn-needing-specified-return-type-param.rs:3:13
|
LL | let _ = f;
| - ^ cannot infer type for type parameter `A` declared on the function `f`
| |
| consider giving this pattern the explicit type `fn() -> A`, where the type parameter `A` is specified
error: aborting due to previous error
For more information about this error, try `rustc --explain E0282`.