@@ -270,8 +270,8 @@ fn compare_method_predicate_entailment<'tcx>(
270
270
let unnormalized_impl_fty = tcx. mk_fn_ptr ( ty:: Binder :: dummy ( unnormalized_impl_sig) ) ;
271
271
272
272
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 ) ;
275
275
276
276
let trait_sig = tcx. bound_fn_sig ( trait_m. def_id ) . subst ( tcx, trait_to_placeholder_substs) ;
277
277
let trait_sig = tcx. liberate_late_bound_regions ( impl_m. def_id , trait_sig) ;
@@ -294,18 +294,17 @@ fn compare_method_predicate_entailment<'tcx>(
294
294
// type would be more appropriate. In other places we have a `Vec<Span>`
295
295
// corresponding to their `Vec<Predicate>`, but we don't have that here.
296
296
// 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 ) ;
298
298
299
299
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" ) ;
301
301
302
302
let emitted = report_trait_method_mismatch (
303
303
& infcx,
304
304
cause,
305
305
terr,
306
- ( trait_m, trait_fty) ,
307
- ( impl_m, impl_fty) ,
308
- trait_sig,
306
+ ( trait_m, trait_sig) ,
307
+ ( impl_m, impl_sig) ,
309
308
impl_trait_ref,
310
309
) ;
311
310
return Err ( emitted) ;
@@ -484,7 +483,8 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
484
483
let impl_trait_ref = tcx. impl_trait_ref ( impl_m. impl_container ( tcx) . unwrap ( ) ) . unwrap ( ) ;
485
484
let param_env = tcx. param_env ( def_id) ;
486
485
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.
488
488
compare_number_of_generics ( tcx, impl_m, trait_m, tcx. hir ( ) . span_if_local ( impl_m. def_id ) , true ) ?;
489
489
compare_generic_param_kinds ( tcx, impl_m, trait_m, true ) ?;
490
490
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>(
577
577
578
578
debug ! ( ?trait_sig, ?impl_sig, "equating function signatures" ) ;
579
579
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
-
583
580
// Unify the whole function signature. We need to do this to fully infer
584
581
// the lifetimes of the return type, but do this after unifying just the
585
582
// return types, since we want to avoid duplicating errors from
586
583
// `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 ) {
588
585
Ok ( ( ) ) => { }
589
586
Err ( terr) => {
590
587
// 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>(
595
592
infcx,
596
593
cause,
597
594
terr,
598
- ( trait_m, trait_fty) ,
599
- ( impl_m, impl_fty) ,
600
- trait_sig,
595
+ ( trait_m, trait_sig) ,
596
+ ( impl_m, impl_sig) ,
601
597
impl_trait_ref,
602
598
) ;
603
599
return Err ( emitted) ;
@@ -771,9 +767,8 @@ fn report_trait_method_mismatch<'tcx>(
771
767
infcx : & InferCtxt < ' tcx > ,
772
768
mut cause : ObligationCause < ' tcx > ,
773
769
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 > ) ,
777
772
impl_trait_ref : ty:: TraitRef < ' tcx > ,
778
773
) -> ErrorGuaranteed {
779
774
let tcx = infcx. tcx ;
@@ -858,10 +853,7 @@ fn report_trait_method_mismatch<'tcx>(
858
853
& mut diag,
859
854
& cause,
860
855
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 } ) ) ,
865
857
terr,
866
858
false ,
867
859
false ,
0 commit comments