Skip to content

Commit 119ae33

Browse files
committed
add missing impl
1 parent 292be5c commit 119ae33

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

library/core/src/ops/function.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,15 @@ mod impls {
310310
(*self).call_mut(args)
311311
}
312312
}
313+
314+
#[stable(feature = "rust1", since = "1.0.0")]
315+
#[rustc_const_unstable(feature = "const_trait_impl", issue = "143874")]
316+
impl<A: Tuple, F: ?Sized> const Fn<A> for &mut F
317+
where
318+
F: [const] Fn<A>,
319+
{
320+
extern "rust-call" fn call(&self, args: A) -> F::Output {
321+
(**self).call(args)
322+
}
323+
}
313324
}

tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ LL | Wrapper::<function>::call;
2929
= note: the following trait bounds were not satisfied:
3030
`Wrapper<function>: Fn<_>`
3131
which is required by `&Wrapper<function>: Fn<_>`
32+
`Wrapper<function>: Fn<_>`
33+
which is required by `&mut Wrapper<function>: Fn<_>`
3234
note: the trait `Fn` must be implemented
3335
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
3436
= help: items from traits can only be used if the trait is implemented and in scope

tests/ui/impl-trait/where-allowed.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
385385
= note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
386386
- impl<A, F> Fn<A> for &F
387387
where A: Tuple, F: Fn<A>, F: ?Sized;
388+
- impl<A, F> Fn<A> for &mut F
389+
where A: Tuple, F: Fn<A>, F: ?Sized;
388390
- impl<Args, F, A> Fn<Args> for Box<F, A>
389391
where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
390392
- impl<F, Args> Fn<Args> for Exclusive<F>

tests/ui/traits/next-solver/well-formed-in-relate.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ LL | x = unconstrained_map();
1010
= note: multiple `impl`s satisfying `_: Fn()` found in the following crates: `alloc`, `core`:
1111
- impl<A, F> Fn<A> for &F
1212
where A: Tuple, F: Fn<A>, F: ?Sized;
13+
- impl<A, F> Fn<A> for &mut F
14+
where A: Tuple, F: Fn<A>, F: ?Sized;
1315
- impl<Args, F, A> Fn<Args> for Box<F, A>
1416
where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
1517
- impl<F, Args> Fn<Args> for Exclusive<F>

0 commit comments

Comments
 (0)