@@ -62,7 +62,7 @@ impl RegionExt for Region {
6262 let def_id = hir_map. local_def_id ( param. hir_id ) ;
6363 let origin = LifetimeDefOrigin :: from_param ( param) ;
6464 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) )
6666 }
6767
6868 fn late ( hir_map : & Map < ' _ > , param : & GenericParam < ' _ > ) -> ( ParamName , Region ) {
@@ -73,7 +73,7 @@ impl RegionExt for Region {
7373 "Region::late: param={:?} depth={:?} def_id={:?} origin={:?}" ,
7474 param, depth, def_id, origin,
7575 ) ;
76- ( param. name . modern ( ) , Region :: LateBound ( depth, def_id, origin) )
76+ ( param. name . normalize_to_macros_2_0 ( ) , Region :: LateBound ( depth, def_id, origin) )
7777 }
7878
7979 fn late_anon ( index : & Cell < u32 > ) -> Region {
@@ -1174,7 +1174,9 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body<'_>) {
11741174
11751175 Scope :: Binder { ref lifetimes, s, .. } => {
11761176 // 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+ {
11781180 let hir_id = tcx. hir ( ) . as_local_hir_id ( def. id ( ) . unwrap ( ) ) . unwrap ( ) ;
11791181
11801182 signal_shadowing_problem (
@@ -1253,7 +1255,7 @@ fn object_lifetime_defaults_for_item(
12531255 fn add_bounds ( set : & mut Set1 < hir:: LifetimeName > , bounds : & [ hir:: GenericBound < ' _ > ] ) {
12541256 for bound in bounds {
12551257 if let hir:: GenericBound :: Outlives ( ref lifetime) = * bound {
1256- set. insert ( lifetime. name . modern ( ) ) ;
1258+ set. insert ( lifetime. name . normalize_to_macros_2_0 ( ) ) ;
12571259 }
12581260 }
12591261 }
@@ -1791,7 +1793,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
17911793 Scope :: Binder { ref lifetimes, s, .. } => {
17921794 match lifetime_ref. name {
17931795 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+ {
17951798 break Some ( def. shifted ( late_depth) ) ;
17961799 }
17971800 }
@@ -2544,7 +2547,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
25442547 let lifetimes: Vec < _ > = params
25452548 . iter ( )
25462549 . 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+ }
25482553 _ => None ,
25492554 } )
25502555 . collect ( ) ;
@@ -2661,7 +2666,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
26612666 }
26622667
26632668 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 ( ) ) {
26652670 let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def. id ( ) . unwrap ( ) ) . unwrap ( ) ;
26662671
26672672 signal_shadowing_problem (
@@ -2799,7 +2804,7 @@ fn insert_late_bound_lifetimes(
27992804 // `'a: 'b` means both `'a` and `'b` are referenced
28002805 appears_in_where_clause
28012806 . regions
2802- . insert ( hir:: LifetimeName :: Param ( param. name . modern ( ) ) ) ;
2807+ . insert ( hir:: LifetimeName :: Param ( param. name . normalize_to_macros_2_0 ( ) ) ) ;
28032808 }
28042809 }
28052810 }
@@ -2821,7 +2826,7 @@ fn insert_late_bound_lifetimes(
28212826 hir:: GenericParamKind :: Type { .. } | hir:: GenericParamKind :: Const { .. } => continue ,
28222827 }
28232828
2824- let lt_name = hir:: LifetimeName :: Param ( param. name . modern ( ) ) ;
2829+ let lt_name = hir:: LifetimeName :: Param ( param. name . normalize_to_macros_2_0 ( ) ) ;
28252830 // appears in the where clauses? early-bound.
28262831 if appears_in_where_clause. regions . contains ( & lt_name) {
28272832 continue ;
@@ -2885,7 +2890,7 @@ fn insert_late_bound_lifetimes(
28852890 }
28862891
28872892 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 ( ) ) ;
28892894 }
28902895 }
28912896
@@ -2902,7 +2907,7 @@ fn insert_late_bound_lifetimes(
29022907 }
29032908
29042909 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 ( ) ) ;
29062911 }
29072912 }
29082913}
0 commit comments