@@ -107,9 +107,6 @@ impl std::fmt::Debug for RegionErrors<'_> {
107
107
#[ derive( Clone , Debug ) ]
108
108
pub ( crate ) enum RegionErrorKind < ' tcx > {
109
109
/// 'a outlives 'b, and both are placeholders.
110
- /// This is a more general variant of `UnexpectedHiddenRegion`,
111
- /// for cases where the mismatched region is a hidden region
112
- /// from an opaque type.
113
110
PlaceholderMismatch {
114
111
rvid_a : RegionVid ,
115
112
rvid_b : RegionVid ,
@@ -127,6 +124,10 @@ pub(crate) enum RegionErrorKind<'tcx> {
127
124
} ,
128
125
129
126
/// An unexpected hidden region for an opaque type.
127
+ /// This is a more specific variant of `UnexpectedHiddenRegion`,
128
+ /// for cases where the mismatched region isn't a hidden region
129
+ /// from an opaque type, but rather any other unexpected, invalid,
130
+ /// or undeclared element.
130
131
UnexpectedHiddenRegion {
131
132
/// The span for the member constraint.
132
133
span : Span ,
@@ -330,8 +331,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
330
331
generic_kind,
331
332
lower_bound,
332
333
span,
333
- failed_due_to_placeholders,
334
- } if failed_due_to_placeholders => {
334
+ failed_due_to_placeholders : true ,
335
+ } => {
335
336
// FIXME. We should handle this case better. It
336
337
// indicates that we have e.g., some region variable
337
338
// whose value is like `'a+'b` where `'a` and `'b` are
@@ -357,26 +358,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
357
358
lower_bound,
358
359
span,
359
360
generic_kind,
360
- failed_due_to_placeholders : _ ,
361
+ failed_due_to_placeholders : false ,
361
362
} => {
362
363
// Try to convert the lower-bound region into something named we can print for
363
364
// the user.
364
- let lower_bound_region = self . to_error_region ( lower_bound) ;
365
-
366
- let type_test_span = span;
367
-
368
- let Some ( lower_bound_region) = lower_bound_region else {
365
+ let Some ( lower_bound_region) = self . to_error_region ( lower_bound) else {
369
366
unreachable ! (
370
- "Found nothing good; lower bound was: {lower_bound:?} for {generic_kind:?} at {type_test_span :?}"
367
+ "Found nothing good; lower bound was: {lower_bound:?} for {generic_kind:?} at {span :?}"
371
368
) ;
372
369
} ;
373
370
debug ! ( ?lower_bound_region) ;
374
371
let generic_ty =
375
372
self . name_regions ( self . infcx . tcx , generic_kind. to_ty ( self . infcx . tcx ) ) ;
376
- let origin = RelateParamBound ( type_test_span , generic_ty, None ) ;
373
+ let origin = RelateParamBound ( span , generic_ty, None ) ;
377
374
self . buffer_error ( self . infcx . err_ctxt ( ) . construct_generic_bound_failure (
378
375
self . body . source . def_id ( ) . expect_local ( ) ,
379
- type_test_span ,
376
+ span ,
380
377
Some ( origin) ,
381
378
self . name_regions ( self . infcx . tcx , generic_kind) ,
382
379
lower_bound_region,
0 commit comments