@@ -607,10 +607,11 @@ mod tests {
607607 }
608608
609609 #[ allow( unused) ]
610- fn spawn_check < F : Future + Send , E : SomeExecutor > ( task : Task < F , Infallible > , exec : & mut E )
611- where
610+ fn spawn_check < F : Future + Send , E : SomeExecutor + Send > (
611+ task : Task < F , Infallible > ,
612+ exec : & mut E ,
613+ ) where
612614 F :: Output : Send ,
613- E : Send ,
614615 {
615616 let spawned: SpawnedTask < F , Infallible , E > = task. spawn ( exec) . 0 ;
616617 fn assert_send < T : Send > ( _: T ) { }
@@ -631,12 +632,10 @@ mod tests {
631632 }
632633
633634 #[ allow( unused) ]
634- fn spawn_check_unpin < F : Future + Unpin , E : SomeExecutor > (
635+ fn spawn_check_unpin < F : Future + Unpin , E : SomeExecutor + Unpin > (
635636 task : Task < F , Infallible > ,
636637 exec : & mut E ,
637- ) where
638- E : Unpin ,
639- {
638+ ) {
640639 let spawned: SpawnedTask < F , Infallible , E > = task. spawn ( exec) . 0 ;
641640 fn assert_unpin < T : Unpin > ( _: T ) { }
642641 assert_unpin ( spawned) ;
@@ -665,13 +664,12 @@ mod tests {
665664 {
666665 type ExecutorNotifier = Infallible ;
667666
668- fn spawn_local < F : Future , Notifier : ObserverNotified < F :: Output > > (
667+ fn spawn_local < F : Future + ' new_task , Notifier : ObserverNotified < F :: Output > > (
669668 & mut self ,
670669 task : Task < F , Notifier > ,
671670 ) -> impl Observer < Value = F :: Output >
672671 where
673672 Self : Sized ,
674- F : ' new_task ,
675673 F :: Output : ' static ,
676674 /* I am a little uncertain whether this is really required */
677675 <F as Future >:: Output : Unpin ,
@@ -682,21 +680,21 @@ mod tests {
682680 observer
683681 }
684682
685- fn spawn_local_async < F : Future , Notifier : ObserverNotified < F :: Output > > (
683+ async fn spawn_local_async <
684+ F : Future + ' new_task ,
685+ Notifier : ObserverNotified < F :: Output > ,
686+ > (
686687 & mut self ,
687688 task : Task < F , Notifier > ,
688- ) -> impl Future < Output = impl Observer < Value = F :: Output > >
689+ ) -> impl Observer < Value = F :: Output >
689690 where
690691 Self : Sized ,
691- F : ' new_task ,
692692 F :: Output : ' static ,
693693 {
694- async {
695- let ( spawn, observer) = task. spawn_local ( self ) ;
696- let pinned_spawn = Box :: pin ( spawn) ;
697- self . 0 . push ( pinned_spawn) ;
698- observer
699- }
694+ let ( spawn, observer) = task. spawn_local ( self ) ;
695+ let pinned_spawn = Box :: pin ( spawn) ;
696+ self . 0 . push ( pinned_spawn) ;
697+ observer
700698 }
701699
702700 fn spawn_local_objsafe (
@@ -729,18 +727,12 @@ mod tests {
729727 > ,
730728 > + ' s ,
731729 > {
732- Box :: new ( async {
733- let ( spawn, observer) = task. spawn_local_objsafe ( self ) ;
734- let pinned_spawn = Box :: pin ( spawn) ;
735- self . 0 . push ( pinned_spawn) ;
736- Box :: new ( observer)
737- as Box <
738- dyn Observer <
739- Value = Box < dyn Any > ,
740- Output = FinishedObservation < Box < dyn Any > > ,
741- > ,
742- >
743- } )
730+ let ( spawn, observer) = task. spawn_local_objsafe ( self ) ;
731+ let pinned_spawn = Box :: pin ( spawn) ;
732+ self . 0 . push ( pinned_spawn) ;
733+ #[ allow( clippy:: type_complexity) ]
734+ let boxed = Box :: new ( observer) as Box < dyn Observer < Value = _ , Output = _ > > ;
735+ Box :: new ( std:: future:: ready ( boxed) )
744736 }
745737
746738 fn executor_notifier ( & mut self ) -> Option < Self :: ExecutorNotifier > {
0 commit comments