@@ -73,7 +73,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
7373
7474 let method = method. unwrap ( ) ;
7575 // HACK(eddyb) ignore self in the definition (see above).
76- let expected_arg_tys = self . expected_inputs_for_expected_output (
76+ let expected_input_tys = self . expected_inputs_for_expected_output (
7777 sp,
7878 expected,
7979 method. sig . output ( ) ,
@@ -83,7 +83,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8383 sp,
8484 expr,
8585 & method. sig . inputs ( ) [ 1 ..] ,
86- & expected_arg_tys [ ..] ,
86+ & expected_input_tys [ ..] ,
8787 args_no_rcvr,
8888 method. sig . c_variadic ,
8989 tuple_arguments,
@@ -249,18 +249,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
249249 err. emit ( ) ;
250250 } ;
251251
252- let mut expected_arg_tys = expected_input_tys. to_vec ( ) ;
252+ let mut expected_input_tys = expected_input_tys. to_vec ( ) ;
253253
254- let formal_tys = if tuple_arguments == TupleArguments {
254+ let formal_input_tys = if tuple_arguments == TupleArguments {
255255 let tuple_type = self . structurally_resolved_type ( call_span, formal_input_tys[ 0 ] ) ;
256256 match tuple_type. kind ( ) {
257257 ty:: Tuple ( arg_types) if arg_types. len ( ) != provided_args. len ( ) => {
258258 param_count_error ( arg_types. len ( ) , provided_args. len ( ) , "E0057" , false , false ) ;
259- expected_arg_tys = vec ! [ ] ;
259+ expected_input_tys = vec ! [ ] ;
260260 self . err_args ( provided_args. len ( ) )
261261 }
262262 ty:: Tuple ( arg_types) => {
263- expected_arg_tys = match expected_arg_tys . get ( 0 ) {
263+ expected_input_tys = match expected_input_tys . get ( 0 ) {
264264 Some ( & ty) => match ty. kind ( ) {
265265 ty:: Tuple ( ref tys) => tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . collect ( ) ,
266266 _ => vec ! [ ] ,
@@ -278,7 +278,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
278278 for the function trait is neither a tuple nor unit"
279279 )
280280 . emit ( ) ;
281- expected_arg_tys = vec ! [ ] ;
281+ expected_input_tys = vec ! [ ] ;
282282 self . err_args ( provided_args. len ( ) )
283283 }
284284 }
@@ -289,32 +289,35 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
289289 formal_input_tys. to_vec ( )
290290 } else {
291291 param_count_error ( expected_arg_count, supplied_arg_count, "E0060" , true , false ) ;
292- expected_arg_tys = vec ! [ ] ;
292+ expected_input_tys = vec ! [ ] ;
293293 self . err_args ( supplied_arg_count)
294294 }
295295 } else {
296296 // is the missing argument of type `()`?
297- let sugg_unit = if expected_arg_tys . len ( ) == 1 && supplied_arg_count == 0 {
298- self . resolve_vars_if_possible ( expected_arg_tys [ 0 ] ) . is_unit ( )
297+ let sugg_unit = if expected_input_tys . len ( ) == 1 && supplied_arg_count == 0 {
298+ self . resolve_vars_if_possible ( expected_input_tys [ 0 ] ) . is_unit ( )
299299 } else if formal_input_tys. len ( ) == 1 && supplied_arg_count == 0 {
300300 self . resolve_vars_if_possible ( formal_input_tys[ 0 ] ) . is_unit ( )
301301 } else {
302302 false
303303 } ;
304304 param_count_error ( expected_arg_count, supplied_arg_count, "E0061" , false , sugg_unit) ;
305305
306- expected_arg_tys = vec ! [ ] ;
306+ expected_input_tys = vec ! [ ] ;
307307 self . err_args ( supplied_arg_count)
308308 } ;
309309
310310 debug ! (
311- "check_argument_types: formal_tys ={:?}" ,
312- formal_tys . iter( ) . map( |t| self . ty_to_string( * t) ) . collect:: <Vec <String >>( )
311+ "check_argument_types: formal_input_tys ={:?}" ,
312+ formal_input_tys . iter( ) . map( |t| self . ty_to_string( * t) ) . collect:: <Vec <String >>( )
313313 ) ;
314314
315- // If there is no expectation, expect formal_tys.
316- let expected_arg_tys =
317- if !expected_arg_tys. is_empty ( ) { expected_arg_tys } else { formal_tys. clone ( ) } ;
315+ // If there is no expectation, expect formal_input_tys.
316+ let expected_input_tys = if !expected_input_tys. is_empty ( ) {
317+ expected_input_tys
318+ } else {
319+ formal_input_tys. clone ( )
320+ } ;
318321
319322 let mut final_arg_types: Vec < ( usize , Ty < ' _ > , Ty < ' _ > ) > = vec ! [ ] ;
320323
@@ -366,12 +369,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
366369 continue ;
367370 }
368371
369- let formal_ty = formal_tys [ i] ;
372+ let formal_ty = formal_input_tys [ i] ;
370373 debug ! ( "checking argument {}: {:?} = {:?}" , i, arg, formal_ty) ;
371374
372375 // The special-cased logic below has three functions:
373376 // 1. Provide as good of an expected type as possible.
374- let expected = Expectation :: rvalue_hint ( self , expected_arg_tys [ i] ) ;
377+ let expected = Expectation :: rvalue_hint ( self , expected_input_tys [ i] ) ;
375378
376379 let checked_ty = self . check_expr_with_expectation ( & arg, expected) ;
377380
0 commit comments