@@ -29,7 +29,7 @@ use rustc_infer::infer::error_reporting::TypeErrCtxt;
2929use  rustc_infer:: infer:: { InferOk ,  TypeTrace } ; 
3030use  rustc_middle:: traits:: select:: OverflowError ; 
3131use  rustc_middle:: traits:: solve:: Goal ; 
32- use  rustc_middle:: traits:: { DefiningAnchor ,   SelectionOutputTypeParameterMismatch } ; 
32+ use  rustc_middle:: traits:: SelectionOutputTypeParameterMismatch ; 
3333use  rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ; 
3434use  rustc_middle:: ty:: error:: { ExpectedFound ,  TypeError } ; 
3535use  rustc_middle:: ty:: fold:: { BottomUpFolder ,  TypeFolder ,  TypeSuperFoldable } ; 
@@ -1151,11 +1151,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11511151                } 
11521152            } 
11531153
1154-             SelectionError :: OpaqueTypeAutoTraitLeakageUnknown ( def_id)  => self . report_opaque_type_auto_trait_leakage ( 
1155-                 & obligation, 
1156-                 def_id, 
1157-             ) , 
1158- 
11591154            TraitNotObjectSafe ( did)  => { 
11601155                let  violations = self . tcx . object_safety_violations ( did) ; 
11611156                report_object_safety_error ( self . tcx ,  span,  did,  violations) 
@@ -1174,10 +1169,16 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
11741169            } 
11751170
11761171            // Already reported in the query. 
1177-             SelectionError :: NotConstEvaluatable ( NotConstEvaluatable :: Error ( _) )  |
1172+             SelectionError :: NotConstEvaluatable ( NotConstEvaluatable :: Error ( _) )  => { 
1173+                 // FIXME(eddyb) remove this once `ErrorGuaranteed` becomes a proof token. 
1174+                 self . tcx . sess . delay_span_bug ( span,  "`ErrorGuaranteed` without an error" ) ; 
1175+                 return ; 
1176+             } 
11781177            // Already reported. 
1179-             Overflow ( OverflowError :: Error ( _) )  => return , 
1180- 
1178+             Overflow ( OverflowError :: Error ( _) )  => { 
1179+                 self . tcx . sess . delay_span_bug ( span,  "`OverflowError` has been reported" ) ; 
1180+                 return ; 
1181+             } 
11811182            Overflow ( _)  => { 
11821183                bug ! ( "overflow should be handled before the `report_selection_error` path" ) ; 
11831184            } 
@@ -1469,12 +1470,6 @@ trait InferCtxtPrivExt<'tcx> {
14691470        terr :  TypeError < ' tcx > , 
14701471    )  -> DiagnosticBuilder < ' tcx ,  ErrorGuaranteed > ; 
14711472
1472-     fn  report_opaque_type_auto_trait_leakage ( 
1473-         & self , 
1474-         obligation :  & PredicateObligation < ' tcx > , 
1475-         def_id :  DefId , 
1476-     )  -> DiagnosticBuilder < ' tcx ,  ErrorGuaranteed > ; 
1477- 
14781473    fn  report_type_parameter_mismatch_error ( 
14791474        & self , 
14801475        obligation :  & PredicateObligation < ' tcx > , 
@@ -3203,39 +3198,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
32033198        ) 
32043199    } 
32053200
3206-     fn  report_opaque_type_auto_trait_leakage ( 
3207-         & self , 
3208-         obligation :  & PredicateObligation < ' tcx > , 
3209-         def_id :  DefId , 
3210-     )  -> DiagnosticBuilder < ' tcx ,  ErrorGuaranteed >  { 
3211-         let  name = match  self . tcx . opaque_type_origin ( def_id. expect_local ( ) )  { 
3212-             hir:: OpaqueTyOrigin :: FnReturn ( _)  | hir:: OpaqueTyOrigin :: AsyncFn ( _)  => { 
3213-                 format ! ( "opaque type" ) 
3214-             } 
3215-             hir:: OpaqueTyOrigin :: TyAlias  {  .. }  => { 
3216-                 format ! ( "`{}`" ,  self . tcx. def_path_debug_str( def_id) ) 
3217-             } 
3218-         } ; 
3219-         let  mut  err = self . tcx . sess . struct_span_err ( 
3220-             obligation. cause . span , 
3221-             format ! ( "cannot check whether the hidden type of {name} satisfies auto traits" ) , 
3222-         ) ; 
3223-         err. span_note ( self . tcx . def_span ( def_id) ,  "opaque type is declared here" ) ; 
3224-         match  self . defining_use_anchor  { 
3225-             DefiningAnchor :: Bubble  | DefiningAnchor :: Error  => { } 
3226-             DefiningAnchor :: Bind ( bind)  => { 
3227-                 err. span_note ( 
3228-                     self . tcx . def_ident_span ( bind) . unwrap_or_else ( || self . tcx . def_span ( bind) ) , 
3229-                     "this item depends on auto traits of the hidden type, \  
3230- \ 
3231- \ 
3232- . to_string ( ) , 
3233-                 ) ; 
3234-             } 
3235-         } ; 
3236-         err
3237-     } 
3238- 
32393201    fn  report_type_parameter_mismatch_error ( 
32403202        & self , 
32413203        obligation :  & PredicateObligation < ' tcx > , 
0 commit comments