`&mut impl Fn()` does not implement `Fn()`
@Kivooeo is already working on this.
Since Oct 21, 2025.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
There are the following blanket implementations of the Fn traits on reference types (abbreviated to omit the argument type):
impl Fn for &F where F: Fnimpl FnMut for &F where F: Fnimpl FnOnce for &F where F: Fnimpl FnMut for &mut F where F: FnMutimpl FnOnce for &mut F where F: FnMut
The following blanket implementation is possible to implement, but is missing from the standard library:
impl Fn for &mut F where F: Fn
As far as I can tell, this blanket impl was overlooked in the initial implementation.
This leads to a weird situation where &mut F implements fewer of the Fn traits than &F. This is somewhat strange.
I'm not sure if this needs to be fixed though, since I can't come up with a realistic use case that would run into this.
I am unsure if this is a breaking change or not, as this is a new implementation of a fundamental trait on a fundamental type. I am unable to find code that compiles in stable rust that would break from this change though.
Meta
Affects stable rust version 1.90.0.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.