Repository: rust
Issue: help change add `FnMut` in where clause no return type
Labels: A-diagnostics,T-compiler

### Code

```Rust
struct FOper<T, U, F>
where F: FnMut(T) -> U,
{
    _phantom: std::marker::PhantomData<fn(T) -> U>,
    pub f: F,
}
impl<T, U, F> FOper<T, U, F> {
    fn new(f: F) -> Self {
        Self {
            _phantom: std::marker::PhantomData,
            f,
        }
    }
}
```


### Current output

```Shell
Checking test_ v0.1.0 (/home/lrne/Project/Rust/test_)
error[E0277]: expected a `FnMut(T)` closure, found `F`
    --> src/main.rs:2591:15
     |
2591 | impl<T, U, F> FOper<T, U, F> {
     |               ^^^^^^^^^^^^^^ expected an `FnMut(T)` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T)> FOper<T, U, F> {
     |             ++++++++++

error[E0277]: expected a `FnMut(T)` closure, found `F`
    --> src/main.rs:2592:21
     |
2592 |     fn new(f: F) -> Self {
     |                     ^^^^ expected an `FnMut(T)` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T)> FOper<T, U, F> {
     |             ++++++++++

error[E0277]: expected a `FnMut(T)` closure, found `F`
    --> src/main.rs:2593:9
     |
2593 |         Self {
     |         ^^^^ expected an `FnMut(T)` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T)> FOper<T, U, F> {
     |             ++++++++++

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test_` (bin "test_") due to 3 previous errors
```


### Desired output

```Shell
Checking test_ v0.1.0 (/home/lrne/Project/Rust/test_)
error[E0277]: expected a `FnMut(T) -> U` closure, found `F`
    --> src/main.rs:2591:15
     |
2591 | impl<T, U, F> FOper<T, U, F> {
     |               ^^^^^^^^^^^^^^ expected an `FnMut(T) -> U` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T) -> U> FOper<T, U, F> {
     |             +++++++++++++++

error[E0277]: expected a `FnMut(T) -> U` closure, found `F`
    --> src/main.rs:2592:21
     |
2592 |     fn new(f: F) -> Self {
     |                     ^^^^ expected an `FnMut(T) -> U` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T) -> U> FOper<T, U, F> {
     |             +++++++++++++++

error[E0277]: expected a `FnMut(T) -> U` closure, found `F`
    --> src/main.rs:2593:9
     |
2593 |         Self {
     |         ^^^^ expected an `FnMut(T) -> U` closure, found `F`
     |
note: required by a bound in `FOper`
    --> src/main.rs:2586:10
     |
2585 | struct FOper<T, U, F>
     |        ----- required by a bound in this struct
2586 | where F: FnMut(T) -> U,
     |          ^^^^^^^^^^^^^ required by this bound in `FOper`
help: consider restricting type parameter `F`
     |
2591 | impl<T, U, F: FnMut(T) -> U> FOper<T, U, F> {
     |             +++++++++++++++

For more information about this error, try `rustc --explain E0277`.
error: could not compile `test_` (bin "test_") due to 3 previous errors
```


### Rationale and extra context

_No response_

### Other cases

_No response_

### Rust Version

```Shell
rustc 1.82.0-nightly (7c2012d0e 2024-07-26)
binary: rustc
commit-hash: 7c2012d0ec3aae89fefc40e5d6b317a0949cda36
commit-date: 2024-07-26
host: aarch64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 18.1.7
```


### Anything else?

_No response_