@@ -711,38 +711,38 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
711711 }
712712 }
713713
714- OutputTypeParameterMismatch ( ref expected_trait_ref, ref actual_trait_ref, _) => {
714+ OutputTypeParameterMismatch ( ref found_trait_ref, ref expected_trait_ref, _) => {
715+ let found_trait_ref = self . resolve_type_vars_if_possible ( & * found_trait_ref) ;
715716 let expected_trait_ref = self . resolve_type_vars_if_possible ( & * expected_trait_ref) ;
716- let actual_trait_ref = self . resolve_type_vars_if_possible ( & * actual_trait_ref) ;
717- if actual_trait_ref. self_ty ( ) . references_error ( ) {
717+ if expected_trait_ref. self_ty ( ) . references_error ( ) {
718718 return ;
719719 }
720- let expected_trait_ty = expected_trait_ref . self_ty ( ) ;
720+ let found_trait_ty = found_trait_ref . self_ty ( ) ;
721721
722- let found_did = expected_trait_ty . ty_to_def_id ( ) ;
722+ let found_did = found_trait_ty . ty_to_def_id ( ) ;
723723 let found_span = found_did. and_then ( |did| {
724724 self . tcx . hir . span_if_local ( did)
725725 } ) ;
726726
727- let self_ty_count =
728- match expected_trait_ref . skip_binder ( ) . substs . type_at ( 1 ) . sty {
727+ let found_ty_count =
728+ match found_trait_ref . skip_binder ( ) . substs . type_at ( 1 ) . sty {
729729 ty:: TyTuple ( ref tys, _) => tys. len ( ) ,
730730 _ => 1 ,
731731 } ;
732- let ( arg_tys , arg_ty_count ) =
733- match actual_trait_ref . skip_binder ( ) . substs . type_at ( 1 ) . sty {
732+ let ( expected_tys , expected_ty_count ) =
733+ match expected_trait_ref . skip_binder ( ) . substs . type_at ( 1 ) . sty {
734734 ty:: TyTuple ( ref tys, _) =>
735735 ( tys. iter ( ) . map ( |t| & t. sty ) . collect ( ) , tys. len ( ) ) ,
736736 ref sty => ( vec ! [ sty] , 1 ) ,
737737 } ;
738- if self_ty_count == arg_ty_count {
738+ if found_ty_count == expected_ty_count {
739739 self . report_closure_arg_mismatch ( span,
740740 found_span,
741- expected_trait_ref ,
742- actual_trait_ref )
741+ found_trait_ref ,
742+ expected_trait_ref )
743743 } else {
744- let arg_tuple = if arg_ty_count == 1 {
745- arg_tys . first ( ) . and_then ( |t| {
744+ let expected_tuple = if expected_ty_count == 1 {
745+ expected_tys . first ( ) . and_then ( |t| {
746746 if let & & ty:: TyTuple ( ref tuptys, _) = t {
747747 Some ( tuptys. len ( ) )
748748 } else {
@@ -753,15 +753,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
753753 None
754754 } ;
755755
756- // FIXME(#44150): Expand this to "N args expected bug a N-tuple found".
756+ // FIXME(#44150): Expand this to "N args expected but a N-tuple found."
757757 // Type of the 1st expected argument is somehow provided as type of a
758758 // found one in that case.
759759 //
760760 // ```
761761 // [1i32, 2, 3].sort_by(|(a, b)| ..)
762762 // // ^^^^^^^^
763- // // actual_trait_ref : std::ops::FnMut<(&i32, &i32)>
764- // // expected_trait_ref : std::ops::FnMut<(&i32,)>
763+ // // expected_trait_ref : std::ops::FnMut<(&i32, &i32)>
764+ // // found_trait_ref : std::ops::FnMut<(&i32,)>
765765 // ```
766766
767767 let closure_args_span = found_did. and_then ( |did| self . tcx . hir . get_if_local ( did) )
@@ -778,10 +778,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
778778 self . report_arg_count_mismatch (
779779 span,
780780 closure_args_span. or ( found_span) ,
781- arg_ty_count ,
782- arg_tuple ,
783- self_ty_count ,
784- expected_trait_ty . is_closure ( )
781+ expected_ty_count ,
782+ expected_tuple ,
783+ found_ty_count ,
784+ found_trait_ty . is_closure ( )
785785 )
786786 }
787787 }
0 commit comments