@@ -429,7 +429,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
429429 }
430430 if let ( hir:: TyKind :: Infer , false ) = ( & ty. kind , self . astconv . allow_ty_infer ( ) ) {
431431 self . inferred_params . push ( ty. span ) ;
432- tcx. ty_error ( ) . into ( )
432+ tcx. ty_error_misc ( ) . into ( )
433433 } else {
434434 self . astconv . ast_ty_to_ty ( ty) . into ( )
435435 }
@@ -502,14 +502,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
502502 _ => false ,
503503 } ) {
504504 // Avoid ICE #86756 when type error recovery goes awry.
505- return tcx. ty_error ( ) . into ( ) ;
505+ return tcx. ty_error_misc ( ) . into ( ) ;
506506 }
507507 tcx. at ( self . span ) . type_of ( param. def_id ) . subst ( tcx, substs) . into ( )
508508 } else if infer_args {
509509 self . astconv . ty_infer ( Some ( param) , self . span ) . into ( )
510510 } else {
511511 // We've already errored above about the mismatch.
512- tcx. ty_error ( ) . into ( )
512+ tcx. ty_error_misc ( ) . into ( )
513513 }
514514 }
515515 GenericParamDefKind :: Const { has_default } => {
@@ -518,8 +518,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
518518 . type_of ( param. def_id )
519519 . no_bound_vars ( )
520520 . expect ( "const parameter types cannot be generic" ) ;
521- if ty. references_error ( ) {
522- return tcx. const_error ( ty) . into ( ) ;
521+ if let Err ( guar ) = ty. error_reported ( ) {
522+ return tcx. const_error_with_guaranteed ( ty, guar ) . into ( ) ;
523523 }
524524 if !infer_args && has_default {
525525 tcx. const_param_default ( param. def_id ) . subst ( tcx, substs. unwrap ( ) ) . into ( )
@@ -1239,9 +1239,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
12391239 }
12401240 let reported = err. emit ( ) ;
12411241 term = match def_kind {
1242- hir:: def:: DefKind :: AssocTy => {
1243- tcx. ty_error_with_guaranteed ( reported) . into ( )
1244- }
1242+ hir:: def:: DefKind :: AssocTy => tcx. ty_error ( reported) . into ( ) ,
12451243 hir:: def:: DefKind :: AssocConst => tcx
12461244 . const_error_with_guaranteed (
12471245 tcx. type_of ( assoc_item_def_id)
@@ -1397,7 +1395,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13971395 . map ( |trait_ref| tcx. def_span ( trait_ref) ) ;
13981396 let reported =
13991397 tcx. sess . emit_err ( TraitObjectDeclaredWithNoTraits { span, trait_alias_span } ) ;
1400- return tcx. ty_error_with_guaranteed ( reported) ;
1398+ return tcx. ty_error ( reported) ;
14011399 }
14021400
14031401 // Check that there are no gross object safety violations;
@@ -1414,7 +1412,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
14141412 & object_safety_violations,
14151413 )
14161414 . emit ( ) ;
1417- return tcx. ty_error_with_guaranteed ( reported) ;
1415+ return tcx. ty_error ( reported) ;
14181416 }
14191417 }
14201418
@@ -1523,10 +1521,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
15231521 if arg == dummy_self. into ( ) {
15241522 let param = & generics. params [ index] ;
15251523 missing_type_params. push ( param. name ) ;
1526- return tcx. ty_error ( ) . into ( ) ;
1524+ return tcx. ty_error_misc ( ) . into ( ) ;
15271525 } else if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
15281526 references_self = true ;
1529- return tcx. ty_error ( ) . into ( ) ;
1527+ return tcx. ty_error_misc ( ) . into ( ) ;
15301528 }
15311529 arg
15321530 } )
@@ -1579,15 +1577,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
15791577 false
15801578 } ) ;
15811579 if references_self {
1582- tcx. sess
1580+ let guar = tcx
1581+ . sess
15831582 . delay_span_bug ( span, "trait object projection bounds reference `Self`" ) ;
15841583 let substs: Vec < _ > = b
15851584 . projection_ty
15861585 . substs
15871586 . iter ( )
15881587 . map ( |arg| {
15891588 if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1590- return tcx. ty_error ( ) . into ( ) ;
1589+ return tcx. ty_error ( guar ) . into ( ) ;
15911590 }
15921591 arg
15931592 } )
@@ -2473,7 +2472,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
24732472 & [ path_str] ,
24742473 item_segment. ident . name ,
24752474 ) ;
2476- return tcx. ty_error_with_guaranteed ( reported)
2475+ return tcx. ty_error ( reported)
24772476 } ;
24782477
24792478 debug ! ( "qpath_to_ty: self_type={:?}" , self_ty) ;
@@ -2820,7 +2819,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
28202819 let index = generics. param_def_id_to_index [ & def_id. to_def_id ( ) ] ;
28212820 tcx. mk_ty_param ( index, tcx. hir ( ) . ty_param_name ( def_id) )
28222821 }
2823- Some ( rbv:: ResolvedArg :: Error ( guar) ) => tcx. ty_error_with_guaranteed ( guar) ,
2822+ Some ( rbv:: ResolvedArg :: Error ( guar) ) => tcx. ty_error ( guar) ,
28242823 arg => bug ! ( "unexpected bound var resolution for {hir_id:?}: {arg:?}" ) ,
28252824 }
28262825 }
@@ -2932,7 +2931,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29322931 {
29332932 err. span_note ( impl_. self_ty . span , "not a concrete type" ) ;
29342933 }
2935- tcx. ty_error_with_guaranteed ( err. emit ( ) )
2934+ tcx. ty_error ( err. emit ( ) )
29362935 } else {
29372936 ty
29382937 }
@@ -2985,7 +2984,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29852984 . sess
29862985 . delay_span_bug ( path. span , "path with `Res::Err` but no error emitted" ) ;
29872986 self . set_tainted_by_errors ( e) ;
2988- self . tcx ( ) . ty_error_with_guaranteed ( e)
2987+ self . tcx ( ) . ty_error ( e)
29892988 }
29902989 _ => span_bug ! ( span, "unexpected resolution: {:?}" , path. res) ,
29912990 }
@@ -3064,7 +3063,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
30643063 let ty = self . ast_ty_to_ty_inner ( qself, false , true ) ;
30653064 self . associated_path_to_ty ( ast_ty. hir_id , ast_ty. span , ty, qself, segment, false )
30663065 . map ( |( ty, _, _) | ty)
3067- . unwrap_or_else ( |_ | tcx. ty_error ( ) )
3066+ . unwrap_or_else ( |guar | tcx. ty_error ( guar ) )
30683067 }
30693068 & hir:: TyKind :: Path ( hir:: QPath :: LangItem ( lang_item, span, _) ) => {
30703069 let def_id = tcx. require_lang_item ( lang_item, Some ( span) ) ;
@@ -3112,7 +3111,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
31123111 // handled specially and will not descend into this routine.
31133112 self . ty_infer ( None , ast_ty. span )
31143113 }
3115- hir:: TyKind :: Err => tcx. ty_error ( ) ,
3114+ hir:: TyKind :: Err => tcx. ty_error_misc ( ) ,
31163115 } ;
31173116
31183117 self . record_ty ( ast_ty. hir_id , result_ty, ast_ty. span ) ;
0 commit comments