@@ -270,8 +270,8 @@ fn compare_method_predicate_entailment<'tcx>(
270270 let unnormalized_impl_fty = tcx. mk_fn_ptr ( ty:: Binder :: dummy ( unnormalized_impl_sig) ) ;
271271
272272 let norm_cause = ObligationCause :: misc ( impl_m_span, impl_m_hir_id) ;
273- let impl_fty = ocx. normalize ( & norm_cause, param_env, unnormalized_impl_fty ) ;
274- debug ! ( "compare_impl_method: impl_fty={:?}" , impl_fty ) ;
273+ let impl_sig = ocx. normalize ( & norm_cause, param_env, unnormalized_impl_sig ) ;
274+ debug ! ( "compare_impl_method: impl_fty={:?}" , impl_sig ) ;
275275
276276 let trait_sig = tcx. bound_fn_sig ( trait_m. def_id ) . subst ( tcx, trait_to_placeholder_substs) ;
277277 let trait_sig = tcx. liberate_late_bound_regions ( impl_m. def_id , trait_sig) ;
@@ -294,18 +294,17 @@ fn compare_method_predicate_entailment<'tcx>(
294294 // type would be more appropriate. In other places we have a `Vec<Span>`
295295 // corresponding to their `Vec<Predicate>`, but we don't have that here.
296296 // Fixing this would improve the output of test `issue-83765.rs`.
297- let result = ocx. sup ( & cause, param_env, trait_fty , impl_fty ) ;
297+ let result = ocx. sup ( & cause, param_env, trait_sig , impl_sig ) ;
298298
299299 if let Err ( terr) = result {
300- debug ! ( ?terr , "sub_types failed: impl ty {:?}, trait ty {:?}" , impl_fty , trait_fty ) ;
300+ debug ! ( ?impl_sig , ?trait_sig , ?terr , "sub_types failed" ) ;
301301
302302 let emitted = report_trait_method_mismatch (
303303 & infcx,
304304 cause,
305305 terr,
306- ( trait_m, trait_fty) ,
307- ( impl_m, impl_fty) ,
308- trait_sig,
306+ ( trait_m, trait_sig) ,
307+ ( impl_m, impl_sig) ,
309308 impl_trait_ref,
310309 ) ;
311310 return Err ( emitted) ;
@@ -484,7 +483,8 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
484483 let impl_trait_ref = tcx. impl_trait_ref ( impl_m. impl_container ( tcx) . unwrap ( ) ) . unwrap ( ) ;
485484 let param_env = tcx. param_env ( def_id) ;
486485
487- // First, check a few of the same thing as `compare_impl_method`, just so we don't ICE during substitutions later.
486+ // First, check a few of the same things as `compare_impl_method`,
487+ // just so we don't ICE during substitution later.
488488 compare_number_of_generics ( tcx, impl_m, trait_m, tcx. hir ( ) . span_if_local ( impl_m. def_id ) , true ) ?;
489489 compare_generic_param_kinds ( tcx, impl_m, trait_m, true ) ?;
490490 check_region_bounds_on_impl_item ( tcx, impl_m, trait_m, true ) ?;
@@ -577,14 +577,11 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
577577
578578 debug ! ( ?trait_sig, ?impl_sig, "equating function signatures" ) ;
579579
580- let trait_fty = tcx. mk_fn_ptr ( ty:: Binder :: dummy ( trait_sig) ) ;
581- let impl_fty = tcx. mk_fn_ptr ( ty:: Binder :: dummy ( impl_sig) ) ;
582-
583580 // Unify the whole function signature. We need to do this to fully infer
584581 // the lifetimes of the return type, but do this after unifying just the
585582 // return types, since we want to avoid duplicating errors from
586583 // `compare_method_predicate_entailment`.
587- match ocx. eq ( & cause, param_env, trait_fty , impl_fty ) {
584+ match ocx. eq ( & cause, param_env, trait_sig , impl_sig ) {
588585 Ok ( ( ) ) => { }
589586 Err ( terr) => {
590587 // This function gets called during `compare_method_predicate_entailment` when normalizing a
@@ -595,9 +592,8 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
595592 infcx,
596593 cause,
597594 terr,
598- ( trait_m, trait_fty) ,
599- ( impl_m, impl_fty) ,
600- trait_sig,
595+ ( trait_m, trait_sig) ,
596+ ( impl_m, impl_sig) ,
601597 impl_trait_ref,
602598 ) ;
603599 return Err ( emitted) ;
@@ -771,9 +767,8 @@ fn report_trait_method_mismatch<'tcx>(
771767 infcx : & InferCtxt < ' tcx > ,
772768 mut cause : ObligationCause < ' tcx > ,
773769 terr : TypeError < ' tcx > ,
774- ( trait_m, trait_fty) : ( & ty:: AssocItem , Ty < ' tcx > ) ,
775- ( impl_m, impl_fty) : ( & ty:: AssocItem , Ty < ' tcx > ) ,
776- trait_sig : ty:: FnSig < ' tcx > ,
770+ ( trait_m, trait_sig) : ( & ty:: AssocItem , ty:: FnSig < ' tcx > ) ,
771+ ( impl_m, impl_sig) : ( & ty:: AssocItem , ty:: FnSig < ' tcx > ) ,
777772 impl_trait_ref : ty:: TraitRef < ' tcx > ,
778773) -> ErrorGuaranteed {
779774 let tcx = infcx. tcx ;
@@ -858,10 +853,7 @@ fn report_trait_method_mismatch<'tcx>(
858853 & mut diag,
859854 & cause,
860855 trait_err_span. map ( |sp| ( sp, "type in trait" . to_owned ( ) ) ) ,
861- Some ( infer:: ValuePairs :: Terms ( ExpectedFound {
862- expected : trait_fty. into ( ) ,
863- found : impl_fty. into ( ) ,
864- } ) ) ,
856+ Some ( infer:: ValuePairs :: Sigs ( ExpectedFound { expected : trait_sig, found : impl_sig } ) ) ,
865857 terr,
866858 false ,
867859 false ,
0 commit comments