@@ -635,28 +635,31 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
635
635
636
636
let mut obligations = vec ! [ ] ;
637
637
638
- for & ( coroutine_def_id, interior) in coroutines. iter ( ) {
639
- debug ! ( ?coroutine_def_id) ;
638
+ if !self . next_trait_solver ( ) {
639
+ for & ( coroutine_def_id, interior) in coroutines. iter ( ) {
640
+ debug ! ( ?coroutine_def_id) ;
641
+
642
+ // Create the `CoroutineWitness` type that we will unify with `interior`.
643
+ let args = ty:: GenericArgs :: identity_for_item (
644
+ self . tcx ,
645
+ self . tcx . typeck_root_def_id ( coroutine_def_id. to_def_id ( ) ) ,
646
+ ) ;
647
+ let witness =
648
+ Ty :: new_coroutine_witness ( self . tcx , coroutine_def_id. to_def_id ( ) , args) ;
640
649
641
- // Create the `CoroutineWitness` type that we will unify with `interior`.
642
- let args = ty:: GenericArgs :: identity_for_item (
643
- self . tcx ,
644
- self . tcx . typeck_root_def_id ( coroutine_def_id. to_def_id ( ) ) ,
645
- ) ;
646
- let witness = Ty :: new_coroutine_witness ( self . tcx , coroutine_def_id. to_def_id ( ) , args) ;
647
-
648
- // Unify `interior` with `witness` and collect all the resulting obligations.
649
- let span = self . tcx . hir_body_owned_by ( coroutine_def_id) . value . span ;
650
- let ty:: Infer ( ty:: InferTy :: TyVar ( _) ) = interior. kind ( ) else {
651
- span_bug ! ( span, "coroutine interior witness not infer: {:?}" , interior. kind( ) )
652
- } ;
653
- let ok = self
654
- . at ( & self . misc ( span) , self . param_env )
655
- // Will never define opaque types, as all we do is instantiate a type variable.
656
- . eq ( DefineOpaqueTypes :: Yes , interior, witness)
657
- . expect ( "Failed to unify coroutine interior type" ) ;
658
-
659
- obligations. extend ( ok. obligations ) ;
650
+ // Unify `interior` with `witness` and collect all the resulting obligations.
651
+ let span = self . tcx . hir_body_owned_by ( coroutine_def_id) . value . span ;
652
+ let ty:: Infer ( ty:: InferTy :: TyVar ( _) ) = interior. kind ( ) else {
653
+ span_bug ! ( span, "coroutine interior witness not infer: {:?}" , interior. kind( ) )
654
+ } ;
655
+ let ok = self
656
+ . at ( & self . misc ( span) , self . param_env )
657
+ // Will never define opaque types, as all we do is instantiate a type variable.
658
+ . eq ( DefineOpaqueTypes :: Yes , interior, witness)
659
+ . expect ( "Failed to unify coroutine interior type" ) ;
660
+
661
+ obligations. extend ( ok. obligations ) ;
662
+ }
660
663
}
661
664
662
665
if !coroutines. is_empty ( ) {
0 commit comments