@@ -62,7 +62,7 @@ impl RegionExt for Region {
62
62
let def_id = hir_map. local_def_id ( param. hir_id ) ;
63
63
let origin = LifetimeDefOrigin :: from_param ( param) ;
64
64
debug ! ( "Region::early: index={} def_id={:?}" , i, def_id) ;
65
- ( param. name . modern ( ) , Region :: EarlyBound ( i, def_id, origin) )
65
+ ( param. name . normalize_to_macros_2_0 ( ) , Region :: EarlyBound ( i, def_id, origin) )
66
66
}
67
67
68
68
fn late ( hir_map : & Map < ' _ > , param : & GenericParam < ' _ > ) -> ( ParamName , Region ) {
@@ -73,7 +73,7 @@ impl RegionExt for Region {
73
73
"Region::late: param={:?} depth={:?} def_id={:?} origin={:?}" ,
74
74
param, depth, def_id, origin,
75
75
) ;
76
- ( param. name . modern ( ) , Region :: LateBound ( depth, def_id, origin) )
76
+ ( param. name . normalize_to_macros_2_0 ( ) , Region :: LateBound ( depth, def_id, origin) )
77
77
}
78
78
79
79
fn late_anon ( index : & Cell < u32 > ) -> Region {
@@ -1174,7 +1174,9 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body<'_>) {
1174
1174
1175
1175
Scope :: Binder { ref lifetimes, s, .. } => {
1176
1176
// FIXME (#24278): non-hygienic comparison
1177
- if let Some ( def) = lifetimes. get ( & hir:: ParamName :: Plain ( label. modern ( ) ) ) {
1177
+ if let Some ( def) =
1178
+ lifetimes. get ( & hir:: ParamName :: Plain ( label. normalize_to_macros_2_0 ( ) ) )
1179
+ {
1178
1180
let hir_id = tcx. hir ( ) . as_local_hir_id ( def. id ( ) . unwrap ( ) ) . unwrap ( ) ;
1179
1181
1180
1182
signal_shadowing_problem (
@@ -1253,7 +1255,7 @@ fn object_lifetime_defaults_for_item(
1253
1255
fn add_bounds ( set : & mut Set1 < hir:: LifetimeName > , bounds : & [ hir:: GenericBound < ' _ > ] ) {
1254
1256
for bound in bounds {
1255
1257
if let hir:: GenericBound :: Outlives ( ref lifetime) = * bound {
1256
- set. insert ( lifetime. name . modern ( ) ) ;
1258
+ set. insert ( lifetime. name . normalize_to_macros_2_0 ( ) ) ;
1257
1259
}
1258
1260
}
1259
1261
}
@@ -1791,7 +1793,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
1791
1793
Scope :: Binder { ref lifetimes, s, .. } => {
1792
1794
match lifetime_ref. name {
1793
1795
LifetimeName :: Param ( param_name) => {
1794
- if let Some ( & def) = lifetimes. get ( & param_name. modern ( ) ) {
1796
+ if let Some ( & def) = lifetimes. get ( & param_name. normalize_to_macros_2_0 ( ) )
1797
+ {
1795
1798
break Some ( def. shifted ( late_depth) ) ;
1796
1799
}
1797
1800
}
@@ -2544,7 +2547,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
2544
2547
let lifetimes: Vec < _ > = params
2545
2548
. iter ( )
2546
2549
. filter_map ( |param| match param. kind {
2547
- GenericParamKind :: Lifetime { .. } => Some ( ( param, param. name . modern ( ) ) ) ,
2550
+ GenericParamKind :: Lifetime { .. } => {
2551
+ Some ( ( param, param. name . normalize_to_macros_2_0 ( ) ) )
2552
+ }
2548
2553
_ => None ,
2549
2554
} )
2550
2555
. collect ( ) ;
@@ -2661,7 +2666,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
2661
2666
}
2662
2667
2663
2668
Scope :: Binder { ref lifetimes, s, .. } => {
2664
- if let Some ( & def) = lifetimes. get ( & param. name . modern ( ) ) {
2669
+ if let Some ( & def) = lifetimes. get ( & param. name . normalize_to_macros_2_0 ( ) ) {
2665
2670
let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def. id ( ) . unwrap ( ) ) . unwrap ( ) ;
2666
2671
2667
2672
signal_shadowing_problem (
@@ -2799,7 +2804,7 @@ fn insert_late_bound_lifetimes(
2799
2804
// `'a: 'b` means both `'a` and `'b` are referenced
2800
2805
appears_in_where_clause
2801
2806
. regions
2802
- . insert ( hir:: LifetimeName :: Param ( param. name . modern ( ) ) ) ;
2807
+ . insert ( hir:: LifetimeName :: Param ( param. name . normalize_to_macros_2_0 ( ) ) ) ;
2803
2808
}
2804
2809
}
2805
2810
}
@@ -2821,7 +2826,7 @@ fn insert_late_bound_lifetimes(
2821
2826
hir:: GenericParamKind :: Type { .. } | hir:: GenericParamKind :: Const { .. } => continue ,
2822
2827
}
2823
2828
2824
- let lt_name = hir:: LifetimeName :: Param ( param. name . modern ( ) ) ;
2829
+ let lt_name = hir:: LifetimeName :: Param ( param. name . normalize_to_macros_2_0 ( ) ) ;
2825
2830
// appears in the where clauses? early-bound.
2826
2831
if appears_in_where_clause. regions . contains ( & lt_name) {
2827
2832
continue ;
@@ -2885,7 +2890,7 @@ fn insert_late_bound_lifetimes(
2885
2890
}
2886
2891
2887
2892
fn visit_lifetime ( & mut self , lifetime_ref : & ' v hir:: Lifetime ) {
2888
- self . regions . insert ( lifetime_ref. name . modern ( ) ) ;
2893
+ self . regions . insert ( lifetime_ref. name . normalize_to_macros_2_0 ( ) ) ;
2889
2894
}
2890
2895
}
2891
2896
@@ -2902,7 +2907,7 @@ fn insert_late_bound_lifetimes(
2902
2907
}
2903
2908
2904
2909
fn visit_lifetime ( & mut self , lifetime_ref : & ' v hir:: Lifetime ) {
2905
- self . regions . insert ( lifetime_ref. name . modern ( ) ) ;
2910
+ self . regions . insert ( lifetime_ref. name . normalize_to_macros_2_0 ( ) ) ;
2906
2911
}
2907
2912
}
2908
2913
}
0 commit comments