@@ -399,7 +399,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
399399 }
400400 ty:: FnPtr ( sig) => ( sig, None ) ,
401401 _ => {
402- let mut skip_first_expr = false ;
402+ for arg in arg_exprs {
403+ self . check_expr ( arg) ;
404+ }
405+
403406 if let hir:: ExprKind :: Path ( hir:: QPath :: Resolved ( _, path) ) = & callee_expr. kind
404407 && let [ segment] = path. segments
405408 && let Some ( mut diag) = self
@@ -422,16 +425,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
422425 return ty;
423426 } else {
424427 diag. emit ( ) ;
425- skip_first_expr = true ;
426428 }
427429 }
428430
429431 let err = self . report_invalid_callee ( call_expr, callee_expr, callee_ty, arg_exprs) ;
430432
431- for arg in arg_exprs. iter ( ) . skip ( skip_first_expr as usize ) {
432- self . check_expr ( arg) ;
433- }
434-
435433 return self . tcx . ty_error_with_guaranteed ( err) ;
436434 }
437435 } ;
@@ -492,9 +490,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
492490 expected : Expectation < ' tcx > ,
493491 ) -> Option < Ty < ' tcx > > {
494492 if let [ callee_expr, rest @ ..] = arg_exprs {
495- // This may happen recursively -- if so, avoid repeatedly checking the expr.
496- let callee_ty = self . typeck_results . borrow ( ) . expr_ty_adjusted_opt ( callee_expr) ;
497- let callee_ty = callee_ty. unwrap_or_else ( || self . check_expr ( callee_expr) ) ;
493+ let callee_ty = self . typeck_results . borrow ( ) . expr_ty_adjusted_opt ( callee_expr) ?;
494+
498495 // First, do a probe with `IsSuggestion(true)` to avoid emitting
499496 // any strange errors. If it's successful, then we'll do a true
500497 // method lookup.
0 commit comments