Skip to content

Commit d5a93c9

Browse files
committed
Fix const_fn_trait_ref_impl, add test for it
1 parent 9b98bbb commit d5a93c9

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

core/src/ops/function.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -576,29 +576,32 @@ mod impls {
576576
use crate::marker::Tuple;
577577

578578
#[stable(feature = "rust1", since = "1.0.0")]
579-
impl<A: Tuple, F: ?Sized> Fn<A> for &F
579+
#[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
580+
impl<A: Tuple, F: ?Sized> const Fn<A> for &F
580581
where
581-
F: Fn<A>,
582+
F: ~const Fn<A>,
582583
{
583584
extern "rust-call" fn call(&self, args: A) -> F::Output {
584585
(**self).call(args)
585586
}
586587
}
587588

588589
#[stable(feature = "rust1", since = "1.0.0")]
589-
impl<A: Tuple, F: ?Sized> FnMut<A> for &F
590+
#[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
591+
impl<A: Tuple, F: ?Sized> const FnMut<A> for &F
590592
where
591-
F: Fn<A>,
593+
F: ~const Fn<A>,
592594
{
593595
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
594596
(**self).call(args)
595597
}
596598
}
597599

598600
#[stable(feature = "rust1", since = "1.0.0")]
599-
impl<A: Tuple, F: ?Sized> FnOnce<A> for &F
601+
#[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
602+
impl<A: Tuple, F: ?Sized> const FnOnce<A> for &F
600603
where
601-
F: Fn<A>,
604+
F: ~const Fn<A>,
602605
{
603606
type Output = F::Output;
604607

@@ -608,19 +611,21 @@ mod impls {
608611
}
609612

610613
#[stable(feature = "rust1", since = "1.0.0")]
611-
impl<A: Tuple, F: ?Sized> FnMut<A> for &mut F
614+
#[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
615+
impl<A: Tuple, F: ?Sized> const FnMut<A> for &mut F
612616
where
613-
F: FnMut<A>,
617+
F: ~const FnMut<A>,
614618
{
615619
extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output {
616620
(*self).call_mut(args)
617621
}
618622
}
619623

620624
#[stable(feature = "rust1", since = "1.0.0")]
621-
impl<A: Tuple, F: ?Sized> FnOnce<A> for &mut F
625+
#[rustc_const_unstable(feature = "const_fn_trait_ref_impls", issue = "101803")]
626+
impl<A: Tuple, F: ?Sized> const FnOnce<A> for &mut F
622627
where
623-
F: FnMut<A>,
628+
F: ~const FnMut<A>,
624629
{
625630
type Output = F::Output;
626631
extern "rust-call" fn call_once(self, args: A) -> F::Output {

0 commit comments

Comments
 (0)