@@ -1164,8 +1164,7 @@ struct UseError<'a> {
11641164} 
11651165
11661166struct  AmbiguityError < ' a >  { 
1167-     span :  Span , 
1168-     name :  Name , 
1167+     ident :  Ident , 
11691168    b1 :  & ' a  NameBinding < ' a > , 
11701169    b2 :  & ' a  NameBinding < ' a > , 
11711170} 
@@ -1818,7 +1817,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
18181817        self . arenas . alloc_module ( module) 
18191818    } 
18201819
1821-     fn  record_use ( & mut  self ,  ident :  Ident ,  ns :  Namespace ,  binding :  & ' a  NameBinding < ' a > ,   span :   Span ) 
1820+     fn  record_use ( & mut  self ,  ident :  Ident ,  ns :  Namespace ,  binding :  & ' a  NameBinding < ' a > ) 
18221821                  -> bool  /* true if an error was reported */  { 
18231822        match  binding. kind  { 
18241823            NameBindingKind :: Import  {  directive,  binding,  ref  used } 
@@ -1827,13 +1826,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
18271826                directive. used . set ( true ) ; 
18281827                self . used_imports . insert ( ( directive. id ,  ns) ) ; 
18291828                self . add_to_glob_map ( directive. id ,  ident) ; 
1830-                 self . record_use ( ident,  ns,  binding,  span ) 
1829+                 self . record_use ( ident,  ns,  binding) 
18311830            } 
18321831            NameBindingKind :: Import  {  .. }  => false , 
18331832            NameBindingKind :: Ambiguity  {  b1,  b2 }  => { 
1834-                 self . ambiguity_errors . push ( AmbiguityError  { 
1835-                     span,  name :  ident. name ,  b1,  b2, 
1836-                 } ) ; 
1833+                 self . ambiguity_errors . push ( AmbiguityError  {  ident,  b1,  b2 } ) ; 
18371834                true 
18381835            } 
18391836            _ => false 
@@ -2853,7 +2850,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
28532850                            Def :: Const ( ..)  if  is_syntactic_ambiguity => { 
28542851                                // Disambiguate in favor of a unit struct/variant 
28552852                                // or constant pattern. 
2856-                                 self . record_use ( ident,  ValueNS ,  binding. unwrap ( ) ,  ident . span ) ; 
2853+                                 self . record_use ( ident,  ValueNS ,  binding. unwrap ( ) ) ; 
28572854                                Some ( PathResolution :: new ( def) ) 
28582855                            } 
28592856                            Def :: StructCtor ( ..)  | Def :: VariantCtor ( ..)  |
@@ -4532,12 +4529,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
45324529        vis. is_accessible_from ( module. normal_ancestor_id ,  self ) 
45334530    } 
45344531
4535-     fn  report_ambiguity_error ( & self ,  name :   Name ,   span :   Span ,  b1 :  & NameBinding ,  b2 :  & NameBinding )  { 
4532+     fn  report_ambiguity_error ( & self ,  ident :   Ident ,  b1 :  & NameBinding ,  b2 :  & NameBinding )  { 
45364533        let  participle = |is_import :  bool | if  is_import {  "imported"  }  else  {  "defined"  } ; 
45374534        let  msg1 =
4538-             format ! ( "`{}` could refer to the name {} here" ,  name ,  participle( b1. is_import( ) ) ) ; 
4535+             format ! ( "`{}` could refer to the name {} here" ,  ident ,  participle( b1. is_import( ) ) ) ; 
45394536        let  msg2 =
4540-             format ! ( "`{}` could also refer to the name {} here" ,  name ,  participle( b2. is_import( ) ) ) ; 
4537+             format ! ( "`{}` could also refer to the name {} here" ,  ident ,  participle( b2. is_import( ) ) ) ; 
45414538        let  note = if  b1. expansion  != Mark :: root ( )  { 
45424539            Some ( if  let  Def :: Macro ( ..)  = b1. def ( )  { 
45434540                format ! ( "macro-expanded {} do not shadow" , 
@@ -4547,16 +4544,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
45474544                        if  b1. is_import( )  {  "imports"  }  else {  "items"  } ) 
45484545            } ) 
45494546        }  else  if  b1. is_glob_import ( )  { 
4550-             Some ( format ! ( "consider adding an explicit import of `{}` to disambiguate" ,  name ) ) 
4547+             Some ( format ! ( "consider adding an explicit import of `{}` to disambiguate" ,  ident ) ) 
45514548        }  else  { 
45524549            None 
45534550        } ; 
45544551
4555-         let  mut  err = struct_span_err ! ( self . session,  span,  E0659 ,  "`{}` is ambiguous" ,  name) ; 
4552+         let  mut  err = struct_span_err ! ( self . session,  ident. span,  E0659 ,  "`{}` is ambiguous" ,  ident) ; 
4553+         err. span_label ( ident. span ,  "ambiguous name" ) ; 
45564554        err. span_note ( b1. span ,  & msg1) ; 
45574555        match  b2. def ( )  { 
45584556            Def :: Macro ( ..)  if  b2. span . is_dummy ( )  =>
4559-                 err. note ( & format ! ( "`{}` is also a builtin macro" ,  name ) ) , 
4557+                 err. note ( & format ! ( "`{}` is also a builtin macro" ,  ident ) ) , 
45604558            _ => err. span_note ( b2. span ,  & msg2) , 
45614559        } ; 
45624560        if  let  Some ( note)  = note { 
@@ -4581,9 +4579,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
45814579            ) ; 
45824580        } 
45834581
4584-         for  & AmbiguityError  {  span ,  name ,  b1,  b2 }  in  & self . ambiguity_errors  { 
4585-             if  reported_spans. insert ( span)  { 
4586-                 self . report_ambiguity_error ( name ,  span ,  b1,  b2) ; 
4582+         for  & AmbiguityError  {  ident ,  b1,  b2 }  in  & self . ambiguity_errors  { 
4583+             if  reported_spans. insert ( ident . span )  { 
4584+                 self . report_ambiguity_error ( ident ,  b1,  b2) ; 
45874585            } 
45884586        } 
45894587
0 commit comments