@@ -694,6 +694,37 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {
694
694
#[ stable( feature = "fused" , since = "1.26.0" ) ]
695
695
impl < I : FusedIterator + ?Sized > FusedIterator for Box < I > { }
696
696
697
+ #[ cfg( not( stage0) ) ]
698
+ #[ unstable( feature = "boxed_closure_impls" ,
699
+ reason = "Box<FnOnce> relies on unsized rvalues and needs to be tested more" ,
700
+ issue = "48055" ) ]
701
+ impl < A , F : FnOnce < A > + ?Sized > FnOnce < A > for Box < F > {
702
+ type Output = <F as FnOnce < A > >:: Output ;
703
+
704
+ default extern "rust-call" fn call_once ( self , args : A ) -> Self :: Output {
705
+ <F as FnOnce < A > >:: call_once ( * self , args)
706
+ }
707
+ }
708
+
709
+ #[ cfg( not( stage0) ) ]
710
+ #[ unstable( feature = "boxed_closure_impls" ,
711
+ reason = "Box<FnOnce> relies on unsized rvalues and needs to be tested more" ,
712
+ issue = "48055" ) ]
713
+ impl < A , F : FnMut < A > + ?Sized > FnMut < A > for Box < F > {
714
+ extern "rust-call" fn call_mut ( & mut self , args : A ) -> Self :: Output {
715
+ <F as FnMut < A > >:: call_mut ( self , args)
716
+ }
717
+ }
718
+
719
+ #[ cfg( not( stage0) ) ]
720
+ #[ unstable( feature = "boxed_closure_impls" ,
721
+ reason = "Box<FnOnce> relies on unsized rvalues and needs to be tested more" ,
722
+ issue = "48055" ) ]
723
+ impl < A , F : Fn < A > + ?Sized > Fn < A > for Box < F > {
724
+ extern "rust-call" fn call ( & self , args : A ) -> Self :: Output {
725
+ <F as Fn < A > >:: call ( self , args)
726
+ }
727
+ }
697
728
698
729
/// `FnBox` is a version of the `FnOnce` intended for use with boxed
699
730
/// closure objects. The idea is that where one would normally store a
@@ -752,6 +783,7 @@ impl<A, F> FnBox<A> for F
752
783
#[ unstable( feature = "fnbox" ,
753
784
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable" , issue = "28796" ) ]
754
785
impl < A , R > FnOnce < A > for Box < dyn FnBox < A , Output = R > + ' _ > {
786
+ #[ cfg( stage0) ]
755
787
type Output = R ;
756
788
757
789
extern "rust-call" fn call_once ( self , args : A ) -> R {
@@ -762,6 +794,7 @@ impl<A, R> FnOnce<A> for Box<dyn FnBox<A, Output = R> + '_> {
762
794
#[ unstable( feature = "fnbox" ,
763
795
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable" , issue = "28796" ) ]
764
796
impl < A , R > FnOnce < A > for Box < dyn FnBox < A , Output = R > + Send + ' _ > {
797
+ #[ cfg( stage0) ]
765
798
type Output = R ;
766
799
767
800
extern "rust-call" fn call_once ( self , args : A ) -> R {
0 commit comments