From 119ae333032a3e5bf1cb088ea7581c0cb85daf8a Mon Sep 17 00:00:00 2001 From: Kivooeo Date: Wed, 29 Oct 2025 21:46:56 +0000 Subject: [PATCH] add missing impl --- library/core/src/ops/function.rs | 11 +++++++++++ .../non_valtreeable_const_arg-2.stderr | 2 ++ tests/ui/impl-trait/where-allowed.stderr | 2 ++ .../traits/next-solver/well-formed-in-relate.stderr | 2 ++ 4 files changed, 17 insertions(+) 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