@@ -429,7 +429,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
429
429
}
430
430
if let ( hir:: TyKind :: Infer , false ) = ( & ty. kind , self . astconv . allow_ty_infer ( ) ) {
431
431
self . inferred_params . push ( ty. span ) ;
432
- tcx. ty_error ( ) . into ( )
432
+ tcx. ty_error_misc ( ) . into ( )
433
433
} else {
434
434
self . astconv . ast_ty_to_ty ( ty) . into ( )
435
435
}
@@ -502,14 +502,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
502
502
_ => false ,
503
503
} ) {
504
504
// Avoid ICE #86756 when type error recovery goes awry.
505
- return tcx. ty_error ( ) . into ( ) ;
505
+ return tcx. ty_error_misc ( ) . into ( ) ;
506
506
}
507
507
tcx. at ( self . span ) . type_of ( param. def_id ) . subst ( tcx, substs) . into ( )
508
508
} else if infer_args {
509
509
self . astconv . ty_infer ( Some ( param) , self . span ) . into ( )
510
510
} else {
511
511
// We've already errored above about the mismatch.
512
- tcx. ty_error ( ) . into ( )
512
+ tcx. ty_error_misc ( ) . into ( )
513
513
}
514
514
}
515
515
GenericParamDefKind :: Const { has_default } => {
@@ -518,8 +518,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
518
518
. type_of ( param. def_id )
519
519
. no_bound_vars ( )
520
520
. 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 ( ) ;
523
523
}
524
524
if !infer_args && has_default {
525
525
tcx. const_param_default ( param. def_id ) . subst ( tcx, substs. unwrap ( ) ) . into ( )
@@ -1239,9 +1239,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1239
1239
}
1240
1240
let reported = err. emit ( ) ;
1241
1241
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 ( ) ,
1245
1243
hir:: def:: DefKind :: AssocConst => tcx
1246
1244
. const_error_with_guaranteed (
1247
1245
tcx. type_of ( assoc_item_def_id)
@@ -1397,7 +1395,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1397
1395
. map ( |trait_ref| tcx. def_span ( trait_ref) ) ;
1398
1396
let reported =
1399
1397
tcx. sess . emit_err ( TraitObjectDeclaredWithNoTraits { span, trait_alias_span } ) ;
1400
- return tcx. ty_error_with_guaranteed ( reported) ;
1398
+ return tcx. ty_error ( reported) ;
1401
1399
}
1402
1400
1403
1401
// Check that there are no gross object safety violations;
@@ -1414,7 +1412,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1414
1412
& object_safety_violations,
1415
1413
)
1416
1414
. emit ( ) ;
1417
- return tcx. ty_error_with_guaranteed ( reported) ;
1415
+ return tcx. ty_error ( reported) ;
1418
1416
}
1419
1417
}
1420
1418
@@ -1523,10 +1521,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1523
1521
if arg == dummy_self. into ( ) {
1524
1522
let param = & generics. params [ index] ;
1525
1523
missing_type_params. push ( param. name ) ;
1526
- return tcx. ty_error ( ) . into ( ) ;
1524
+ return tcx. ty_error_misc ( ) . into ( ) ;
1527
1525
} else if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1528
1526
references_self = true ;
1529
- return tcx. ty_error ( ) . into ( ) ;
1527
+ return tcx. ty_error_misc ( ) . into ( ) ;
1530
1528
}
1531
1529
arg
1532
1530
} )
@@ -1579,15 +1577,16 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1579
1577
false
1580
1578
} ) ;
1581
1579
if references_self {
1582
- tcx. sess
1580
+ let guar = tcx
1581
+ . sess
1583
1582
. delay_span_bug ( span, "trait object projection bounds reference `Self`" ) ;
1584
1583
let substs: Vec < _ > = b
1585
1584
. projection_ty
1586
1585
. substs
1587
1586
. iter ( )
1588
1587
. map ( |arg| {
1589
1588
if arg. walk ( ) . any ( |arg| arg == dummy_self. into ( ) ) {
1590
- return tcx. ty_error ( ) . into ( ) ;
1589
+ return tcx. ty_error ( guar ) . into ( ) ;
1591
1590
}
1592
1591
arg
1593
1592
} )
@@ -2473,7 +2472,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2473
2472
& [ path_str] ,
2474
2473
item_segment. ident . name ,
2475
2474
) ;
2476
- return tcx. ty_error_with_guaranteed ( reported)
2475
+ return tcx. ty_error ( reported)
2477
2476
} ;
2478
2477
2479
2478
debug ! ( "qpath_to_ty: self_type={:?}" , self_ty) ;
@@ -2820,7 +2819,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2820
2819
let index = generics. param_def_id_to_index [ & def_id. to_def_id ( ) ] ;
2821
2820
tcx. mk_ty_param ( index, tcx. hir ( ) . ty_param_name ( def_id) )
2822
2821
}
2823
- Some ( rbv:: ResolvedArg :: Error ( guar) ) => tcx. ty_error_with_guaranteed ( guar) ,
2822
+ Some ( rbv:: ResolvedArg :: Error ( guar) ) => tcx. ty_error ( guar) ,
2824
2823
arg => bug ! ( "unexpected bound var resolution for {hir_id:?}: {arg:?}" ) ,
2825
2824
}
2826
2825
}
@@ -2932,7 +2931,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2932
2931
{
2933
2932
err. span_note ( impl_. self_ty . span , "not a concrete type" ) ;
2934
2933
}
2935
- tcx. ty_error_with_guaranteed ( err. emit ( ) )
2934
+ tcx. ty_error ( err. emit ( ) )
2936
2935
} else {
2937
2936
ty
2938
2937
}
@@ -2985,7 +2984,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2985
2984
. sess
2986
2985
. delay_span_bug ( path. span , "path with `Res::Err` but no error emitted" ) ;
2987
2986
self . set_tainted_by_errors ( e) ;
2988
- self . tcx ( ) . ty_error_with_guaranteed ( e)
2987
+ self . tcx ( ) . ty_error ( e)
2989
2988
}
2990
2989
_ => span_bug ! ( span, "unexpected resolution: {:?}" , path. res) ,
2991
2990
}
@@ -3064,7 +3063,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3064
3063
let ty = self . ast_ty_to_ty_inner ( qself, false , true ) ;
3065
3064
self . associated_path_to_ty ( ast_ty. hir_id , ast_ty. span , ty, qself, segment, false )
3066
3065
. map ( |( ty, _, _) | ty)
3067
- . unwrap_or_else ( |_ | tcx. ty_error ( ) )
3066
+ . unwrap_or_else ( |guar | tcx. ty_error ( guar ) )
3068
3067
}
3069
3068
& hir:: TyKind :: Path ( hir:: QPath :: LangItem ( lang_item, span, _) ) => {
3070
3069
let def_id = tcx. require_lang_item ( lang_item, Some ( span) ) ;
@@ -3112,7 +3111,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
3112
3111
// handled specially and will not descend into this routine.
3113
3112
self . ty_infer ( None , ast_ty. span )
3114
3113
}
3115
- hir:: TyKind :: Err => tcx. ty_error ( ) ,
3114
+ hir:: TyKind :: Err => tcx. ty_error_misc ( ) ,
3116
3115
} ;
3117
3116
3118
3117
self . record_ty ( ast_ty. hir_id , result_ty, ast_ty. span ) ;
0 commit comments