@@ -15,7 +15,7 @@ use rustc_middle::ty::{self, suggest_constraining_type_params, Ty, TyCtxt, TypeV
1515use  rustc_trait_selection:: traits:: error_reporting:: InferCtxtExt ; 
1616use  rustc_trait_selection:: traits:: misc:: { can_type_implement_copy,  CopyImplementationError } ; 
1717use  rustc_trait_selection:: traits:: predicate_for_trait_def; 
18- use  rustc_trait_selection:: traits:: { self ,  ObligationCause ,   TraitEngine ,   TraitEngineExt } ; 
18+ use  rustc_trait_selection:: traits:: { self ,  ObligationCause } ; 
1919use  std:: collections:: BTreeMap ; 
2020
2121pub  fn  check_trait ( tcx :  TyCtxt < ' _ > ,  trait_def_id :  DefId )  { 
@@ -109,15 +109,13 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
109109                // it is not immediately clear why Copy is not implemented for a field, since 
110110                // all we point at is the field itself. 
111111                tcx. infer_ctxt ( ) . ignoring_regions ( ) . enter ( |infcx| { 
112-                     let  mut  fulfill_cx = <dyn  TraitEngine < ' _ > >:: new ( tcx) ; 
113-                     fulfill_cx. register_bound ( 
112+                     for  error in  traits:: fully_solve_bound ( 
114113                        & infcx, 
114+                         traits:: ObligationCause :: dummy_with_span ( field_ty_span) , 
115115                        param_env, 
116116                        ty, 
117117                        tcx. lang_items ( ) . copy_trait ( ) . unwrap ( ) , 
118-                         traits:: ObligationCause :: dummy_with_span ( field_ty_span) , 
119-                     ) ; 
120-                     for  error in  fulfill_cx. select_all_or_error ( & infcx)  { 
118+                     )  { 
121119                        let  error_predicate = error. obligation . predicate ; 
122120                        // Only note if it's not the root obligation, otherwise it's trivial and 
123121                        // should be self-explanatory (i.e. a field literally doesn't implement Copy). 
@@ -315,24 +313,20 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did:
315313                    ) ) 
316314                    . emit ( ) ; 
317315                }  else  { 
318-                     let  mut  fulfill_cx = <dyn  TraitEngine < ' _ > >:: new ( infcx. tcx ) ; 
319- 
320-                     for  field in  coerced_fields { 
321-                         let  predicate = predicate_for_trait_def ( 
322-                             tcx, 
323-                             param_env, 
324-                             cause. clone ( ) , 
325-                             dispatch_from_dyn_trait, 
326-                             0 , 
327-                             field. ty ( tcx,  substs_a) , 
328-                             & [ field. ty ( tcx,  substs_b) . into ( ) ] , 
329-                         ) ; 
330- 
331-                         fulfill_cx. register_predicate_obligation ( & infcx,  predicate) ; 
332-                     } 
333- 
334-                     // Check that all transitive obligations are satisfied. 
335-                     let  errors = fulfill_cx. select_all_or_error ( & infcx) ; 
316+                     let  errors = traits:: fully_solve_obligations ( 
317+                         & infcx, 
318+                         coerced_fields. into_iter ( ) . map ( |field| { 
319+                             predicate_for_trait_def ( 
320+                                 tcx, 
321+                                 param_env, 
322+                                 cause. clone ( ) , 
323+                                 dispatch_from_dyn_trait, 
324+                                 0 , 
325+                                 field. ty ( tcx,  substs_a) , 
326+                                 & [ field. ty ( tcx,  substs_b) . into ( ) ] , 
327+                             ) 
328+                         } ) , 
329+                     ) ; 
336330                    if  !errors. is_empty ( )  { 
337331                        infcx. report_fulfillment_errors ( & errors,  None ,  false ) ; 
338332                    } 
@@ -573,8 +567,6 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
573567            } 
574568        } ; 
575569
576-         let  mut  fulfill_cx = <dyn  TraitEngine < ' _ > >:: new ( infcx. tcx ) ; 
577- 
578570        // Register an obligation for `A: Trait<B>`. 
579571        let  cause = traits:: ObligationCause :: misc ( span,  impl_hir_id) ; 
580572        let  predicate = predicate_for_trait_def ( 
@@ -586,10 +578,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
586578            source, 
587579            & [ target. into ( ) ] , 
588580        ) ; 
589-         fulfill_cx. register_predicate_obligation ( & infcx,  predicate) ; 
590- 
591-         // Check that all transitive obligations are satisfied. 
592-         let  errors = fulfill_cx. select_all_or_error ( & infcx) ; 
581+         let  errors = traits:: fully_solve_obligation ( & infcx,  predicate) ; 
593582        if  !errors. is_empty ( )  { 
594583            infcx. report_fulfillment_errors ( & errors,  None ,  false ) ; 
595584        } 
0 commit comments