@@ -182,9 +182,7 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
182182 . collect_referenced_late_bound_regions ( & poly_trait_ref)
183183 . into_iter ( )
184184 . filter_map ( |br| match br {
185- ty:: BrNamed ( _, name) if name != kw:: UnderscoreLifetime => {
186- Some ( GenericParamDef :: lifetime ( name) )
187- }
185+ ty:: BrNamed ( _, name) if br. is_named ( ) => Some ( GenericParamDef :: lifetime ( name) ) ,
188186 _ => None ,
189187 } )
190188 . collect ( ) ;
@@ -233,16 +231,11 @@ pub(crate) fn clean_middle_const<'tcx>(
233231pub ( crate ) fn clean_middle_region < ' tcx > ( region : ty:: Region < ' tcx > ) -> Option < Lifetime > {
234232 match * region {
235233 ty:: ReStatic => Some ( Lifetime :: statik ( ) ) ,
234+ _ if !region. has_name ( ) => None ,
236235 ty:: ReLateBound ( _, ty:: BoundRegion { kind : ty:: BrNamed ( _, name) , .. } ) => {
237- if name != kw:: UnderscoreLifetime { Some ( Lifetime ( name) ) } else { None }
238- }
239- ty:: ReEarlyBound ( ref data) => {
240- if data. name != kw:: UnderscoreLifetime {
241- Some ( Lifetime ( data. name ) )
242- } else {
243- None
244- }
236+ Some ( Lifetime ( name) )
245237 }
238+ ty:: ReEarlyBound ( ref data) => Some ( Lifetime ( data. name ) ) ,
246239 ty:: ReLateBound ( ..)
247240 | ty:: ReFree ( ..)
248241 | ty:: ReVar ( ..)
@@ -396,7 +389,7 @@ fn clean_projection_predicate<'tcx>(
396389 . collect_referenced_late_bound_regions ( & pred)
397390 . into_iter ( )
398391 . filter_map ( |br| match br {
399- ty:: BrNamed ( _, name) if name != kw :: UnderscoreLifetime => Some ( Lifetime ( name) ) ,
392+ ty:: BrNamed ( _, name) if br . is_named ( ) => Some ( Lifetime ( name) ) ,
400393 _ => None ,
401394 } )
402395 . collect ( ) ;
@@ -660,7 +653,7 @@ fn clean_ty_generics<'tcx>(
660653 . params
661654 . iter ( )
662655 . filter_map ( |param| match param. kind {
663- ty:: GenericParamDefKind :: Lifetime if param. name == kw :: UnderscoreLifetime => None ,
656+ ty:: GenericParamDefKind :: Lifetime if param. is_anonymous_lifetime ( ) => None ,
664657 ty:: GenericParamDefKind :: Lifetime => Some ( clean_generic_param_def ( param, cx) ) ,
665658 ty:: GenericParamDefKind :: Type { synthetic, .. } => {
666659 if param. name == kw:: SelfUpper {
@@ -1460,8 +1453,11 @@ fn maybe_expand_private_type_alias<'tcx>(
14601453 } ) ;
14611454 if let Some ( lt) = lifetime {
14621455 let lt_def_id = cx. tcx . hir ( ) . local_def_id ( param. hir_id ) ;
1463- let cleaned =
1464- if !lt. is_elided ( ) { clean_lifetime ( lt, cx) } else { Lifetime :: elided ( ) } ;
1456+ let cleaned = if !lt. is_anonymous ( ) {
1457+ clean_lifetime ( lt, cx)
1458+ } else {
1459+ Lifetime :: elided ( )
1460+ } ;
14651461 substs. insert ( lt_def_id. to_def_id ( ) , SubstParam :: Lifetime ( cleaned) ) ;
14661462 }
14671463 indices. lifetimes += 1 ;
@@ -1892,7 +1888,7 @@ fn clean_generic_args<'tcx>(
18921888 . args
18931889 . iter ( )
18941890 . map ( |arg| match arg {
1895- hir:: GenericArg :: Lifetime ( lt) if !lt. is_elided ( ) => {
1891+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
18961892 GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
18971893 }
18981894 hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
0 commit comments