-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
&mut impl Fn() does not implement Fn() #147931
Copy link
Copy link
Open
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)C-bugCategory: This is a bug.Category: This is a bug.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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: FnMutThe following blanket implementation is possible to implement, but is missing from the standard library:
impl Fn for &mut F where F: FnAs far as I can tell, this blanket impl was overlooked in the initial implementation.
This leads to a weird situation where
&mut Fimplements 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.