@@ -694,6 +694,37 @@ impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {
694694#[ stable( feature = "fused" , since = "1.26.0" ) ]
695695impl < I : FusedIterator + ?Sized > FusedIterator for Box < I > { }
696696
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+ }
697728
698729/// `FnBox` is a version of the `FnOnce` intended for use with boxed
699730/// closure objects. The idea is that where one would normally store a
@@ -752,6 +783,7 @@ impl<A, F> FnBox<A> for F
752783#[ unstable( feature = "fnbox" ,
753784 reason = "will be deprecated if and when `Box<FnOnce>` becomes usable" , issue = "28796" ) ]
754785impl < A , R > FnOnce < A > for Box < dyn FnBox < A , Output = R > + ' _ > {
786+ #[ cfg( stage0) ]
755787 type Output = R ;
756788
757789 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> + '_> {
762794#[ unstable( feature = "fnbox" ,
763795 reason = "will be deprecated if and when `Box<FnOnce>` becomes usable" , issue = "28796" ) ]
764796impl < A , R > FnOnce < A > for Box < dyn FnBox < A , Output = R > + Send + ' _ > {
797+ #[ cfg( stage0) ]
765798 type Output = R ;
766799
767800 extern "rust-call" fn call_once ( self , args : A ) -> R {
0 commit comments