diff --git a/library/core/src/ops/async_function.rs b/library/core/src/ops/async_function.rs
index 6be42ca7d32fe..34b6799d1b286 100644
--- a/library/core/src/ops/async_function.rs
+++ b/library/core/src/ops/async_function.rs
@@ -126,6 +126,16 @@ mod impls {
F::async_call_mut(self, args)
}
}
+
+ #[stable(feature = "async_closure", since = "1.85.0")]
+ impl<'a, A: Tuple, F: ?Sized> AsyncFn for &'a mut F
+ where
+ F: AsyncFn,
+ {
+ extern "rust-call" fn async_call(&self, args: A) -> Self::CallRefFuture<'_> {
+ F::async_call(*self, args)
+ }
+ }
}
mod internal_implementation_detail {
diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs
index 479368ba8f801..63054f67cdd9e 100644
--- a/library/core/src/ops/function.rs
+++ b/library/core/src/ops/function.rs
@@ -310,4 +310,15 @@ mod impls {
(*self).call_mut(args)
}
}
+
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
+ impl const Fn for &mut F
+ where
+ F: [const] Fn,
+ {
+ extern "rust-call" fn call(&self, args: A) -> F::Output {
+ (**self).call(args)
+ }
+ }
}
diff --git a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr
index 72dfda50ea5ca..42c0957aa4d6f 100644
--- a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr
+++ b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr
@@ -29,6 +29,8 @@ LL | Wrapper::::call;
= note: the following trait bounds were not satisfied:
`Wrapper: Fn<_>`
which is required by `&Wrapper: Fn<_>`
+ `Wrapper: Fn<_>`
+ which is required by `&mut Wrapper: Fn<_>`
note: the trait `Fn` must be implemented
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
= help: items from traits can only be used if the trait is implemented and in scope
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 4d8f23bf7ca64..a1d5c0df0e2b6 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -385,6 +385,8 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
= note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
- impl Fn for &F
where A: Tuple, F: Fn, F: ?Sized;
+ - impl Fn for &mut F
+ where A: Tuple, F: Fn, F: ?Sized;
- impl Fn for Box
where Args: Tuple, F: Fn, A: Allocator, F: ?Sized;
- impl Fn for Exclusive
diff --git a/tests/ui/traits/next-solver/well-formed-in-relate.stderr b/tests/ui/traits/next-solver/well-formed-in-relate.stderr
index d79e465b3e387..087a463ee09ab 100644
--- a/tests/ui/traits/next-solver/well-formed-in-relate.stderr
+++ b/tests/ui/traits/next-solver/well-formed-in-relate.stderr
@@ -10,6 +10,8 @@ LL | x = unconstrained_map();
= note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
- impl Fn for &F
where A: Tuple, F: Fn, F: ?Sized;
+ - impl Fn for &mut F
+ where A: Tuple, F: Fn, F: ?Sized;
- impl Fn for Box
where Args: Tuple, F: Fn, A: Allocator, F: ?Sized;
- impl Fn for Exclusive