Skip to content

Commit e0cffea

Browse files
committed
Remove Copy and add impls for Fn only, due to Arc
1 parent ad0b709 commit e0cffea

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

library/alloc/src/sync.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,21 +1663,24 @@ impl Arc<dyn Any + Send + Sync> {
16631663
}
16641664
}
16651665

1666-
impl<Args, F: FnOnce<Args> + ?Sized + Copy> FnOnce<Args> for Arc<F> {
1666+
#[stable(feature = "arc_fn_impls", since = "1.57.0")]
1667+
impl<Args, F: Fn<Args> + ?Sized> FnOnce<Args> for Arc<F> {
16671668
type Output = <F as FnOnce<Args>>::Output;
16681669

16691670
extern "rust-call" fn call_once(self, args: Args) -> Self::Output {
1670-
<F as FnOnce<Args>>::call_once(*self, args)
1671+
<F as Fn<Args>>::call(&self, args)
16711672
}
16721673
}
16731674

1674-
impl<Args, F: FnMut<Args> + ?Sized + Copy> FnMut<Args> for Arc<F> {
1675+
#[stable(feature = "arc_fn_impls", since = "1.57.0")]
1676+
impl<Args, F: Fn<Args> + ?Sized> FnMut<Args> for Arc<F> {
16751677
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output {
1676-
<F as FnMut<Args>>::call_mut(self, args)
1678+
<F as Fn<Args>>::call(self, args)
16771679
}
16781680
}
16791681

1680-
impl<Args, F: Fn<Args> + ?Sized + Copy> Fn<Args> for Arc<F> {
1682+
#[stable(feature = "arc_fn_impls", since = "1.57.0")]
1683+
impl<Args, F: Fn<Args> + ?Sized> Fn<Args> for Arc<F> {
16811684
extern "rust-call" fn call(&self, args: Args) -> Self::Output {
16821685
<F as Fn<Args>>::call(self, args)
16831686
}

0 commit comments

Comments
 (0)