Repository: rust
Issue: 'Expected <function pointer>, found <function item>' diagnostic could explicitly suggest casting
Labels: A-diagnostics,T-compiler,D-confusing

### Code

```rs
fn foo() -> usize {
    0
}

fn bar() -> usize {
    1
}

fn main() {
    let _x: Vec<(&str, fn() -> usize)> = [("foo", foo)].into_iter().collect();
}
```

### Current output
```rs
error[E0277]: a value of type `Vec<(&str, fn() -> usize)>` cannot be built from an iterator over elements of type `(&str, fn() -> usize {foo})`
    --> src/main.rs:10:69
     |
10   |     let _x: Vec<(&str, fn() -> usize)> = [("foo", foo)].into_iter().collect();
     |                                                                     ^^^^^^^ value of type `Vec<(&str, fn() -> usize)>` cannot be built from `std::iter::Iterator<Item=(&str, fn() -> usize {foo})>`
     |
     = help: the trait `FromIterator<(&str, fn() -> usize {foo})>` is not implemented for `Vec<(&str, fn() -> usize)>`
     = help: the trait `FromIterator<(&str, fn() -> usize)>` is implemented for `Vec<(&str, fn() -> usize)>`
     = help: for that trait implementation, expected `fn() -> usize`, found `fn() -> usize {foo}`
```
### Desired output
```rs
error[E0277]: a value of type `Vec<(&str, fn() -> usize)>` cannot be built from an iterator over elements of type `(&str, fn() -> usize {foo})`
    --> src/main.rs:10:69
     |
10   |     let _x: Vec<(&str, fn() -> usize)> = [("foo", foo)].into_iter().collect();
     |                                                                     ^^^^^^^ value of type `Vec<(&str, fn() -> usize)>` cannot be built from `std::iter::Iterator<Item=(&str, fn() -> usize {foo})>`
     |
     = help: the trait `FromIterator<(&str, fn() -> usize {foo})>` is not implemented for `Vec<(&str, fn() -> usize)>`
     = help: the trait `FromIterator<(&str, fn() -> usize)>` is implemented for `Vec<(&str, fn() -> usize)>`
     = help: for that trait implementation, expected `fn() -> usize`, found `fn() -> usize {foo}`
     = help: consider casting the fn item to a fn pointer using `as fn() -> usize`
```

### Rationale and extra context

If we add a second entry in the array, we get a type check error suggesting this:
```rs
  --> src/main.rs:10:65
   |
10 |     let _x: Vec<(&str, fn() -> usize)> = [("foo", foo), ("bar", bar)].into_iter().collect();
   |                                                                 ^^^ expected fn item, found a different fn item
   |
   = note: expected fn item `fn() -> _ {foo}`
              found fn item `fn() -> _ {bar}`
   = note: different fn items have unique types, even if their signatures are the same
   = help: consider casting both fn items to fn pointers using `as fn() -> usize`
```
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 (662180b34 2024-10-20)
binary: rustc
commit-hash: 662180b34d95f72d05b7c467b0baf4d23d36b1e1
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_

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_DATA_START$${"user":"mu001999"}$$TRIAGEBOT_ASSIGN_DATA_END -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->