'Expected <function pointer>, found <function item>' diagnostic could explicitly suggest casting #132648
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
If we add a second entry in the array, we get a type check error suggesting this:
This can lead to a confusing diagnostic if one is not aware of the distinction between fn items and pointers
Other cases
No response
Rust Version
$ rustc 1.84.0-nightly (662180b 2024-10-20)
binary: rustc
commit-hash: 662180b
commit-date: 2024-10-20
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Anything else?
No response
The text was updated successfully, but these errors were encountered: