@@ -182,9 +182,7 @@ fn clean_poly_trait_ref_with_bindings<'tcx>(
182
182
. collect_referenced_late_bound_regions ( & poly_trait_ref)
183
183
. into_iter ( )
184
184
. 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) ) ,
188
186
_ => None ,
189
187
} )
190
188
. collect ( ) ;
@@ -233,16 +231,11 @@ pub(crate) fn clean_middle_const<'tcx>(
233
231
pub ( crate ) fn clean_middle_region < ' tcx > ( region : ty:: Region < ' tcx > ) -> Option < Lifetime > {
234
232
match * region {
235
233
ty:: ReStatic => Some ( Lifetime :: statik ( ) ) ,
234
+ _ if !region. has_name ( ) => None ,
236
235
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) )
245
237
}
238
+ ty:: ReEarlyBound ( ref data) => Some ( Lifetime ( data. name ) ) ,
246
239
ty:: ReLateBound ( ..)
247
240
| ty:: ReFree ( ..)
248
241
| ty:: ReVar ( ..)
@@ -396,7 +389,7 @@ fn clean_projection_predicate<'tcx>(
396
389
. collect_referenced_late_bound_regions ( & pred)
397
390
. into_iter ( )
398
391
. 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) ) ,
400
393
_ => None ,
401
394
} )
402
395
. collect ( ) ;
@@ -660,7 +653,7 @@ fn clean_ty_generics<'tcx>(
660
653
. params
661
654
. iter ( )
662
655
. 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 ,
664
657
ty:: GenericParamDefKind :: Lifetime => Some ( clean_generic_param_def ( param, cx) ) ,
665
658
ty:: GenericParamDefKind :: Type { synthetic, .. } => {
666
659
if param. name == kw:: SelfUpper {
@@ -1460,8 +1453,11 @@ fn maybe_expand_private_type_alias<'tcx>(
1460
1453
} ) ;
1461
1454
if let Some ( lt) = lifetime {
1462
1455
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
+ } ;
1465
1461
substs. insert ( lt_def_id. to_def_id ( ) , SubstParam :: Lifetime ( cleaned) ) ;
1466
1462
}
1467
1463
indices. lifetimes += 1 ;
@@ -1892,7 +1888,7 @@ fn clean_generic_args<'tcx>(
1892
1888
. args
1893
1889
. iter ( )
1894
1890
. map ( |arg| match arg {
1895
- hir:: GenericArg :: Lifetime ( lt) if !lt. is_elided ( ) => {
1891
+ hir:: GenericArg :: Lifetime ( lt) if !lt. is_anonymous ( ) => {
1896
1892
GenericArg :: Lifetime ( clean_lifetime ( * lt, cx) )
1897
1893
}
1898
1894
hir:: GenericArg :: Lifetime ( _) => GenericArg :: Lifetime ( Lifetime :: elided ( ) ) ,
0 commit comments