@@ -71,7 +71,7 @@ use rustc_query_system::ich::StableHashingContext;
7171use  rustc_session:: lint:: builtin:: PRIVATE_MACRO_USE ; 
7272use  rustc_session:: lint:: { BuiltinLintDiag ,  LintBuffer } ; 
7373use  rustc_span:: hygiene:: { ExpnId ,  LocalExpnId ,  MacroKind ,  SyntaxContext ,  Transparency } ; 
74- use  rustc_span:: { DUMMY_SP ,  Ident ,  Span ,  Symbol ,  kw,  sym} ; 
74+ use  rustc_span:: { DUMMY_SP ,  Ident ,  Macros20NormalizedIdent ,   Span ,  Symbol ,  kw,  sym} ; 
7575use  smallvec:: { SmallVec ,  smallvec} ; 
7676use  tracing:: debug; 
7777
@@ -531,7 +531,7 @@ impl ModuleKind {
531531struct  BindingKey  { 
532532    /// The identifier for the binding, always the `normalize_to_macros_2_0` version of the 
533533/// identifier. 
534- ident :  Ident , 
534+ ident :  Macros20NormalizedIdent , 
535535    ns :  Namespace , 
536536    /// When we add an underscore binding (with ident `_`) to some module, this field has 
537537/// a non-zero value that uniquely identifies this binding in that module. 
@@ -543,7 +543,7 @@ struct BindingKey {
543543
544544impl  BindingKey  { 
545545    fn  new ( ident :  Ident ,  ns :  Namespace )  -> Self  { 
546-         BindingKey  {  ident :  ident . normalize_to_macros_2_0 ( ) ,  ns,  disambiguator :  0  } 
546+         BindingKey  {  ident :  Macros20NormalizedIdent :: new ( ident ) ,  ns,  disambiguator :  0  } 
547547    } 
548548
549549    fn  new_disambiguated ( 
@@ -552,7 +552,7 @@ impl BindingKey {
552552        disambiguator :  impl  FnOnce ( )  -> u32 , 
553553    )  -> BindingKey  { 
554554        let  disambiguator = if  ident. name  == kw:: Underscore  {  disambiguator ( )  }  else  {  0  } ; 
555-         BindingKey  {  ident :  ident . normalize_to_macros_2_0 ( ) ,  ns,  disambiguator } 
555+         BindingKey  {  ident :  Macros20NormalizedIdent :: new ( ident ) ,  ns,  disambiguator } 
556556    } 
557557} 
558558
@@ -593,7 +593,8 @@ struct ModuleData<'ra> {
593593    globs :  RefCell < Vec < Import < ' ra > > > , 
594594
595595    /// Used to memoize the traits in this module for faster searches through all traits in scope. 
596- traits :  RefCell < Option < Box < [ ( Ident ,  NameBinding < ' ra > ,  Option < Module < ' ra > > ) ] > > > , 
596+ traits : 
597+         RefCell < Option < Box < [ ( Macros20NormalizedIdent ,  NameBinding < ' ra > ,  Option < Module < ' ra > > ) ] > > > , 
597598
598599    /// Span of the module itself. Used for error reporting. 
599600span :  Span , 
@@ -659,7 +660,7 @@ impl<'ra> Module<'ra> {
659660    fn  for_each_child < ' tcx ,  R :  AsRef < Resolver < ' ra ,  ' tcx > > > ( 
660661        self , 
661662        resolver :  & R , 
662-         mut  f :  impl  FnMut ( & R ,  Ident ,  Namespace ,  NameBinding < ' ra > ) , 
663+         mut  f :  impl  FnMut ( & R ,  Macros20NormalizedIdent ,  Namespace ,  NameBinding < ' ra > ) , 
663664    )  { 
664665        for  ( key,  name_resolution)  in  resolver. as_ref ( ) . resolutions ( self ) . borrow ( ) . iter ( )  { 
665666            if  let  Some ( binding)  = name_resolution. borrow ( ) . best_binding ( )  { 
@@ -671,7 +672,7 @@ impl<'ra> Module<'ra> {
671672    fn  for_each_child_mut < ' tcx ,  R :  AsMut < Resolver < ' ra ,  ' tcx > > > ( 
672673        self , 
673674        resolver :  & mut  R , 
674-         mut  f :  impl  FnMut ( & mut  R ,  Ident ,  Namespace ,  NameBinding < ' ra > ) , 
675+         mut  f :  impl  FnMut ( & mut  R ,  Macros20NormalizedIdent ,  Namespace ,  NameBinding < ' ra > ) , 
675676    )  { 
676677        for  ( key,  name_resolution)  in  resolver. as_mut ( ) . resolutions ( self ) . borrow ( ) . iter ( )  { 
677678            if  let  Some ( binding)  = name_resolution. borrow ( ) . best_binding ( )  { 
@@ -1054,7 +1055,7 @@ pub struct Resolver<'ra, 'tcx> {
10541055    graph_root :  Module < ' ra > , 
10551056
10561057    prelude :  Option < Module < ' ra > > , 
1057-     extern_prelude :  FxIndexMap < Ident ,  ExternPreludeEntry < ' ra > > , 
1058+     extern_prelude :  FxIndexMap < Macros20NormalizedIdent ,  ExternPreludeEntry < ' ra > > , 
10581059
10591060    /// N.B., this is used only for better diagnostics, not name resolution itself. 
10601061field_names :  LocalDefIdMap < Vec < Ident > > , 
@@ -1499,17 +1500,19 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14991500                    && let  name = Symbol :: intern ( name) 
15001501                    && name. can_be_raw ( ) 
15011502                { 
1502-                     Some ( ( Ident :: with_dummy_span ( name) ,  Default :: default ( ) ) ) 
1503+                     Some ( ( Macros20NormalizedIdent :: with_dummy_span ( name) ,  Default :: default ( ) ) ) 
15031504                }  else  { 
15041505                    None 
15051506                } 
15061507            } ) 
15071508            . collect ( ) ; 
15081509
15091510        if  !attr:: contains_name ( attrs,  sym:: no_core)  { 
1510-             extern_prelude. insert ( Ident :: with_dummy_span ( sym:: core) ,  Default :: default ( ) ) ; 
1511+             extern_prelude
1512+                 . insert ( Macros20NormalizedIdent :: with_dummy_span ( sym:: core) ,  Default :: default ( ) ) ; 
15111513            if  !attr:: contains_name ( attrs,  sym:: no_std)  { 
1512-                 extern_prelude. insert ( Ident :: with_dummy_span ( sym:: std) ,  Default :: default ( ) ) ; 
1514+                 extern_prelude
1515+                     . insert ( Macros20NormalizedIdent :: with_dummy_span ( sym:: std) ,  Default :: default ( ) ) ; 
15131516            } 
15141517        } 
15151518
@@ -1879,7 +1882,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
18791882        for  & ( trait_name,  trait_binding,  trait_module)  in  traits. as_ref ( ) . unwrap ( ) . iter ( )  { 
18801883            if  self . trait_may_have_item ( trait_module,  assoc_item)  { 
18811884                let  def_id = trait_binding. res ( ) . def_id ( ) ; 
1882-                 let  import_ids = self . find_transitive_imports ( & trait_binding. kind ,  trait_name) ; 
1885+                 let  import_ids = self . find_transitive_imports ( & trait_binding. kind ,  trait_name. 0 ) ; 
18831886                found_traits. push ( TraitCandidate  {  def_id,  import_ids } ) ; 
18841887            } 
18851888        } 
@@ -2020,7 +2023,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
20202023            // Avoid marking `extern crate` items that refer to a name from extern prelude, 
20212024            // but not introduce it, as used if they are accessed from lexical scope. 
20222025            if  used == Used :: Scope  { 
2023-                 if  let  Some ( entry)  = self . extern_prelude . get ( & ident . normalize_to_macros_2_0 ( ) )  { 
2026+                 if  let  Some ( entry)  = self . extern_prelude . get ( & Macros20NormalizedIdent :: new ( ident ) )  { 
20242027                    if  !entry. introduced_by_item  && entry. binding . get ( )  == Some ( used_binding)  { 
20252028                        return ; 
20262029                    } 
@@ -2179,7 +2182,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
21792182
21802183    fn  extern_prelude_get ( & mut  self ,  ident :  Ident ,  finalize :  bool )  -> Option < NameBinding < ' ra > >  { 
21812184        let  mut  record_use = None ; 
2182-         let  entry = self . extern_prelude . get ( & ident . normalize_to_macros_2_0 ( ) ) ; 
2185+         let  entry = self . extern_prelude . get ( & Macros20NormalizedIdent :: new ( ident ) ) ; 
21832186        let  binding = entry. and_then ( |entry| match  entry. binding . get ( )  { 
21842187            Some ( binding)  if  binding. is_import ( )  => { 
21852188                if  finalize { 
0 commit comments