diff options
| author | onestacked <chrisi.schrefl@gmail.com> | 2022-09-14 01:42:40 +0200 |
|---|---|---|
| committer | onestacked <chrisi.schrefl@gmail.com> | 2022-09-14 14:19:11 +0200 |
| commit | 404b60bf6b2e761188db0e0e5984a4065afaf9cf (patch) | |
| tree | 021778e944831f4016b368859a32fde75035df24 /library/core/src/ops/function.rs | |
| parent | c97922dca563cb7f9385b18dbf7ca8c97f8e1597 (diff) | |
| download | rust-404b60bf6b2e761188db0e0e5984a4065afaf9cf.tar.gz rust-404b60bf6b2e761188db0e0e5984a4065afaf9cf.zip | |
Constify impl Fn* &(mut) Fn*
Diffstat (limited to 'library/core/src/ops/function.rs')
| -rw-r--r-- | library/core/src/ops/function.rs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/library/core/src/ops/function.rs b/library/core/src/ops/function.rs index c5a194b7d0a..827851c62ae 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -250,9 +250,10 @@ pub trait FnOnce<Args> { mod impls { #[stable(feature = "rust1", since = "1.0.0")] - impl<A, F: ?Sized> Fn<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "none")] + impl<A, F: ?Sized> const Fn<A> for &F where - F: Fn<A>, + F: ~const Fn<A>, { extern "rust-call" fn call(&self, args: A) -> F::Output { (**self).call(args) @@ -260,9 +261,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A, F: ?Sized> FnMut<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "none")] + impl<A, F: ?Sized> const FnMut<A> for &F where - F: Fn<A>, + F: ~const Fn<A>, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (**self).call(args) @@ -270,9 +272,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A, F: ?Sized> FnOnce<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "none")] + impl<A, F: ?Sized> const FnOnce<A> for &F where - F: Fn<A>, + F: ~const Fn<A>, { type Output = F::Output; @@ -282,9 +285,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A, F: ?Sized> FnMut<A> for &mut F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "none")] + impl<A, F: ?Sized> const FnMut<A> for &mut F where - F: FnMut<A>, + F: ~const FnMut<A>, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (*self).call_mut(args) @@ -292,9 +296,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A, F: ?Sized> FnOnce<A> for &mut F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "none")] + impl<A, F: ?Sized> const FnOnce<A> for &mut F where - F: FnMut<A>, + F: ~const FnMut<A>, { type Output = F::Output; extern "rust-call" fn call_once(self, args: A) -> F::Output { |
