@@ -527,12 +527,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
527
527
self . resolve_ty_and_res_fully_qualified_call ( qpath, expr. hir_id , expr. span ) ;
528
528
let ty = match res {
529
529
Res :: Err => {
530
- self . set_tainted_by_errors ( ) ;
531
- tcx. ty_error ( )
530
+ let e =
531
+ self . tcx . sess . delay_span_bug ( qpath. span ( ) , "`Res::Err` but no error emitted" ) ;
532
+ self . set_tainted_by_errors ( e) ;
533
+ tcx. ty_error_with_guaranteed ( e)
532
534
}
533
535
Res :: Def ( DefKind :: Ctor ( _, CtorKind :: Fictive ) , _) => {
534
- report_unexpected_variant_res ( tcx, res, qpath, expr. span ) ;
535
- tcx. ty_error ( )
536
+ let e = report_unexpected_variant_res ( tcx, res, qpath, expr. span ) ;
537
+ tcx. ty_error_with_guaranteed ( e )
536
538
}
537
539
_ => self . instantiate_value_path ( segs, opt_ty, res, expr. span , expr. hir_id ) . 0 ,
538
540
} ;
@@ -1962,7 +1964,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1962
1964
expr_span : Span ,
1963
1965
) {
1964
1966
if variant. is_recovered ( ) {
1965
- self . set_tainted_by_errors ( ) ;
1967
+ self . set_tainted_by_errors (
1968
+ self . tcx
1969
+ . sess
1970
+ . delay_span_bug ( expr_span, "parser recovered but no error was emitted" ) ,
1971
+ ) ;
1966
1972
return ;
1967
1973
}
1968
1974
let mut err = self . err_ctxt ( ) . type_error_struct_with_diag (
0 commit comments