@@ -73,7 +73,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
73
73
74
74
let method = method. unwrap ( ) ;
75
75
// 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 (
77
77
sp,
78
78
expected,
79
79
method. sig . output ( ) ,
@@ -83,7 +83,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
83
83
sp,
84
84
expr,
85
85
& method. sig . inputs ( ) [ 1 ..] ,
86
- & expected_arg_tys [ ..] ,
86
+ & expected_input_tys [ ..] ,
87
87
args_no_rcvr,
88
88
method. sig . c_variadic ,
89
89
tuple_arguments,
@@ -249,18 +249,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
249
249
err. emit ( ) ;
250
250
} ;
251
251
252
- let mut expected_arg_tys = expected_input_tys. to_vec ( ) ;
252
+ let mut expected_input_tys = expected_input_tys. to_vec ( ) ;
253
253
254
- let formal_tys = if tuple_arguments == TupleArguments {
254
+ let formal_input_tys = if tuple_arguments == TupleArguments {
255
255
let tuple_type = self . structurally_resolved_type ( call_span, formal_input_tys[ 0 ] ) ;
256
256
match tuple_type. kind ( ) {
257
257
ty:: Tuple ( arg_types) if arg_types. len ( ) != provided_args. len ( ) => {
258
258
param_count_error ( arg_types. len ( ) , provided_args. len ( ) , "E0057" , false , false ) ;
259
- expected_arg_tys = vec ! [ ] ;
259
+ expected_input_tys = vec ! [ ] ;
260
260
self . err_args ( provided_args. len ( ) )
261
261
}
262
262
ty:: Tuple ( arg_types) => {
263
- expected_arg_tys = match expected_arg_tys . get ( 0 ) {
263
+ expected_input_tys = match expected_input_tys . get ( 0 ) {
264
264
Some ( & ty) => match ty. kind ( ) {
265
265
ty:: Tuple ( ref tys) => tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . collect ( ) ,
266
266
_ => vec ! [ ] ,
@@ -278,7 +278,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
278
278
for the function trait is neither a tuple nor unit"
279
279
)
280
280
. emit ( ) ;
281
- expected_arg_tys = vec ! [ ] ;
281
+ expected_input_tys = vec ! [ ] ;
282
282
self . err_args ( provided_args. len ( ) )
283
283
}
284
284
}
@@ -289,32 +289,35 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
289
289
formal_input_tys. to_vec ( )
290
290
} else {
291
291
param_count_error ( expected_arg_count, supplied_arg_count, "E0060" , true , false ) ;
292
- expected_arg_tys = vec ! [ ] ;
292
+ expected_input_tys = vec ! [ ] ;
293
293
self . err_args ( supplied_arg_count)
294
294
}
295
295
} else {
296
296
// 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 ( )
299
299
} else if formal_input_tys. len ( ) == 1 && supplied_arg_count == 0 {
300
300
self . resolve_vars_if_possible ( formal_input_tys[ 0 ] ) . is_unit ( )
301
301
} else {
302
302
false
303
303
} ;
304
304
param_count_error ( expected_arg_count, supplied_arg_count, "E0061" , false , sugg_unit) ;
305
305
306
- expected_arg_tys = vec ! [ ] ;
306
+ expected_input_tys = vec ! [ ] ;
307
307
self . err_args ( supplied_arg_count)
308
308
} ;
309
309
310
310
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 >>( )
313
313
) ;
314
314
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
+ } ;
318
321
319
322
let mut final_arg_types: Vec < ( usize , Ty < ' _ > , Ty < ' _ > ) > = vec ! [ ] ;
320
323
@@ -366,12 +369,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
366
369
continue ;
367
370
}
368
371
369
- let formal_ty = formal_tys [ i] ;
372
+ let formal_ty = formal_input_tys [ i] ;
370
373
debug ! ( "checking argument {}: {:?} = {:?}" , i, arg, formal_ty) ;
371
374
372
375
// The special-cased logic below has three functions:
373
376
// 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] ) ;
375
378
376
379
let checked_ty = self . check_expr_with_expectation ( & arg, expected) ;
377
380
0 commit comments