@@ -4,7 +4,7 @@ use super::{Expectation, FnCtxt, TupleArgumentsFlag};
44
55use crate :: type_error_struct;
66use rustc_ast:: util:: parser:: PREC_POSTFIX ;
7- use rustc_errors:: { struct_span_err, Applicability , Diagnostic , StashKey } ;
7+ use rustc_errors:: { struct_span_err, Applicability , Diagnostic , ErrorGuaranteed , StashKey } ;
88use rustc_hir as hir;
99use rustc_hir:: def:: { self , CtorKind , Namespace , Res } ;
1010use rustc_hir:: def_id:: DefId ;
@@ -424,21 +424,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
424424 }
425425 }
426426
427- self . report_invalid_callee ( call_expr, callee_expr, callee_ty, arg_exprs) ;
428-
429- // This is the "default" function signature, used in case of error.
430- // In that case, we check each argument against "error" in order to
431- // set up all the node type bindings.
432- (
433- ty:: Binder :: dummy ( self . tcx . mk_fn_sig (
434- self . err_args ( arg_exprs. len ( ) ) . into_iter ( ) ,
435- self . tcx . ty_error ( ) ,
436- false ,
437- hir:: Unsafety :: Normal ,
438- abi:: Abi :: Rust ,
439- ) ) ,
440- None ,
441- )
427+ let err = self . report_invalid_callee ( call_expr, callee_expr, callee_ty, arg_exprs) ;
428+
429+ return self . tcx . ty_error_with_guaranteed ( err) ;
442430 }
443431 } ;
444432
@@ -591,7 +579,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
591579 callee_expr : & ' tcx hir:: Expr < ' tcx > ,
592580 callee_ty : Ty < ' tcx > ,
593581 arg_exprs : & ' tcx [ hir:: Expr < ' tcx > ] ,
594- ) {
582+ ) -> ErrorGuaranteed {
595583 let mut unit_variant = None ;
596584 if let hir:: ExprKind :: Path ( qpath) = & callee_expr. kind
597585 && let Res :: Def ( def:: DefKind :: Ctor ( kind, CtorKind :: Const ) , _)
@@ -720,7 +708,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
720708 err. span_label ( span, label) ;
721709 }
722710 }
723- err. emit ( ) ;
711+ err. emit ( )
724712 }
725713
726714 fn confirm_deferred_closure_call (
0 commit comments