-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #71311 - estebank:fn-type-param, r=varkor
On `FnDef` type annotation suggestion, use fn-pointer output Address the last point in #71209.
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/test/ui/suggestions/fn-needing-specified-return-type-param.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn f<A>() -> A { unimplemented!() } | ||
fn foo() { | ||
let _ = f; //~ ERROR type annotations needed for `fn() -> A` | ||
} | ||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/suggestions/fn-needing-specified-return-type-param.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |