diff options
| author | onestacked <chrisi.schrefl@gmail.com> | 2022-11-07 17:41:58 +0100 | 
|---|---|---|
| committer | onestacked <chrisi.schrefl@gmail.com> | 2022-11-07 17:41:58 +0100 | 
| commit | 0c9896bfaa6c7bfd5d34119b7aecffbcc036b201 (patch) | |
| tree | 15389963f70e50dfde8f3f6950680cc46bcc66f5 /library/core/src/ops/function.rs | |
| parent | 391ba78ab442610a63310b9a3d24646082628081 (diff) | |
| download | rust-0c9896bfaa6c7bfd5d34119b7aecffbcc036b201.tar.gz rust-0c9896bfaa6c7bfd5d34119b7aecffbcc036b201.zip | |
Fix `const_fn_trait_ref_impl`, add test for it
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 8d4b0a7ccac..11b43b621c7 100644 --- a/library/core/src/ops/function.rs +++ b/library/core/src/ops/function.rs @@ -576,9 +576,10 @@ mod impls { use crate::marker::Tuple; #[stable(feature = "rust1", since = "1.0.0")] - impl<A: Tuple, F: ?Sized> Fn<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")] + impl<A: Tuple, 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) @@ -586,9 +587,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A: Tuple, F: ?Sized> FnMut<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")] + impl<A: Tuple, 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) @@ -596,9 +598,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A: Tuple, F: ?Sized> FnOnce<A> for &F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")] + impl<A: Tuple, F: ?Sized> const FnOnce<A> for &F where - F: Fn<A>, + F: ~const Fn<A>, { type Output = F::Output; @@ -608,9 +611,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A: Tuple, F: ?Sized> FnMut<A> for &mut F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")] + impl<A: Tuple, 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) @@ -618,9 +622,10 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A: Tuple, F: ?Sized> FnOnce<A> for &mut F + #[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")] + impl<A: Tuple, 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 { | 
