@@ -4,7 +4,7 @@ use super::{Expectation, FnCtxt, TupleArgumentsFlag};
4
4
5
5
use crate :: type_error_struct;
6
6
use 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 } ;
8
8
use rustc_hir as hir;
9
9
use rustc_hir:: def:: { self , CtorKind , Namespace , Res } ;
10
10
use rustc_hir:: def_id:: DefId ;
@@ -424,21 +424,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
424
424
}
425
425
}
426
426
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) ;
442
430
}
443
431
} ;
444
432
@@ -591,7 +579,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
591
579
callee_expr : & ' tcx hir:: Expr < ' tcx > ,
592
580
callee_ty : Ty < ' tcx > ,
593
581
arg_exprs : & ' tcx [ hir:: Expr < ' tcx > ] ,
594
- ) {
582
+ ) -> ErrorGuaranteed {
595
583
let mut unit_variant = None ;
596
584
if let hir:: ExprKind :: Path ( qpath) = & callee_expr. kind
597
585
&& let Res :: Def ( def:: DefKind :: Ctor ( kind, CtorKind :: Const ) , _)
@@ -720,7 +708,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
720
708
err. span_label ( span, label) ;
721
709
}
722
710
}
723
- err. emit ( ) ;
711
+ err. emit ( )
724
712
}
725
713
726
714
fn confirm_deferred_closure_call (
0 commit comments