@@ -29,7 +29,7 @@ use rustc_infer::infer::error_reporting::TypeErrCtxt;
29
29
use rustc_infer:: infer:: { InferOk , TypeTrace } ;
30
30
use rustc_middle:: traits:: select:: OverflowError ;
31
31
use rustc_middle:: traits:: solve:: Goal ;
32
- use rustc_middle:: traits:: { DefiningAnchor , SelectionOutputTypeParameterMismatch } ;
32
+ use rustc_middle:: traits:: SelectionOutputTypeParameterMismatch ;
33
33
use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
34
34
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
35
35
use rustc_middle:: ty:: fold:: { BottomUpFolder , TypeFolder , TypeSuperFoldable } ;
@@ -1151,11 +1151,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1151
1151
}
1152
1152
}
1153
1153
1154
- SelectionError :: OpaqueTypeAutoTraitLeakageUnknown ( def_id) => self . report_opaque_type_auto_trait_leakage (
1155
- & obligation,
1156
- def_id,
1157
- ) ,
1158
-
1159
1154
TraitNotObjectSafe ( did) => {
1160
1155
let violations = self . tcx . object_safety_violations ( did) ;
1161
1156
report_object_safety_error ( self . tcx , span, did, violations)
@@ -1174,10 +1169,16 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
1174
1169
}
1175
1170
1176
1171
// 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
+ }
1178
1177
// 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
+ }
1181
1182
Overflow ( _) => {
1182
1183
bug ! ( "overflow should be handled before the `report_selection_error` path" ) ;
1183
1184
}
@@ -1469,12 +1470,6 @@ trait InferCtxtPrivExt<'tcx> {
1469
1470
terr : TypeError < ' tcx > ,
1470
1471
) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > ;
1471
1472
1472
- fn report_opaque_type_auto_trait_leakage (
1473
- & self ,
1474
- obligation : & PredicateObligation < ' tcx > ,
1475
- def_id : DefId ,
1476
- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > ;
1477
-
1478
1473
fn report_type_parameter_mismatch_error (
1479
1474
& self ,
1480
1475
obligation : & PredicateObligation < ' tcx > ,
@@ -3203,39 +3198,6 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
3203
3198
)
3204
3199
}
3205
3200
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
- but may also be registering the hidden type. \
3231
- This is not supported right now. \
3232
- You can try moving the opaque type and the item that actually registers a hidden type into a new submodule". to_string ( ) ,
3233
- ) ;
3234
- }
3235
- } ;
3236
- err
3237
- }
3238
-
3239
3201
fn report_type_parameter_mismatch_error (
3240
3202
& self ,
3241
3203
obligation : & PredicateObligation < ' tcx > ,
0 commit comments