@@ -527,12 +527,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
527527 self . resolve_ty_and_res_fully_qualified_call ( qpath, expr. hir_id , expr. span ) ;
528528 let ty = match res {
529529 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)
532534 }
533535 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 )
536538 }
537539 _ => self . instantiate_value_path ( segs, opt_ty, res, expr. span , expr. hir_id ) . 0 ,
538540 } ;
@@ -1962,7 +1964,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19621964 expr_span : Span ,
19631965 ) {
19641966 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+ ) ;
19661972 return ;
19671973 }
19681974 let mut err = self . err_ctxt ( ) . type_error_struct_with_diag (
0 commit comments