@@ -1225,12 +1225,10 @@ enum NameBindingKind<'a> {
12251225 binding : & ' a NameBinding < ' a > ,
12261226 directive : & ' a ImportDirective < ' a > ,
12271227 used : Cell < bool > ,
1228- legacy_self_import : bool ,
12291228 } ,
12301229 Ambiguity {
12311230 b1 : & ' a NameBinding < ' a > ,
12321231 b2 : & ' a NameBinding < ' a > ,
1233- legacy : bool ,
12341232 }
12351233}
12361234
@@ -1252,15 +1250,13 @@ struct AmbiguityError<'a> {
12521250 lexical : bool ,
12531251 b1 : & ' a NameBinding < ' a > ,
12541252 b2 : & ' a NameBinding < ' a > ,
1255- legacy : bool ,
12561253}
12571254
12581255impl < ' a > NameBinding < ' a > {
12591256 fn module ( & self ) -> Option < Module < ' a > > {
12601257 match self . kind {
12611258 NameBindingKind :: Module ( module) => Some ( module) ,
12621259 NameBindingKind :: Import { binding, .. } => binding. module ( ) ,
1263- NameBindingKind :: Ambiguity { legacy : true , b1, .. } => b1. module ( ) ,
12641260 _ => None ,
12651261 }
12661262 }
@@ -1270,7 +1266,6 @@ impl<'a> NameBinding<'a> {
12701266 NameBindingKind :: Def ( def) => def,
12711267 NameBindingKind :: Module ( module) => module. def ( ) . unwrap ( ) ,
12721268 NameBindingKind :: Import { binding, .. } => binding. def ( ) ,
1273- NameBindingKind :: Ambiguity { legacy : true , b1, .. } => b1. def ( ) ,
12741269 NameBindingKind :: Ambiguity { .. } => Def :: Err ,
12751270 }
12761271 }
@@ -1853,27 +1848,20 @@ impl<'a> Resolver<'a> {
18531848 fn record_use ( & mut self , ident : Ident , ns : Namespace , binding : & ' a NameBinding < ' a > , span : Span )
18541849 -> bool /* true if an error was reported */ {
18551850 match binding. kind {
1856- NameBindingKind :: Import { directive, binding, ref used, legacy_self_import }
1851+ NameBindingKind :: Import { directive, binding, ref used }
18571852 if !used. get ( ) => {
18581853 used. set ( true ) ;
18591854 directive. used . set ( true ) ;
1860- if legacy_self_import {
1861- self . warn_legacy_self_import ( directive) ;
1862- return false ;
1863- }
18641855 self . used_imports . insert ( ( directive. id , ns) ) ;
18651856 self . add_to_glob_map ( directive. id , ident) ;
18661857 self . record_use ( ident, ns, binding, span)
18671858 }
18681859 NameBindingKind :: Import { .. } => false ,
1869- NameBindingKind :: Ambiguity { b1, b2, legacy } => {
1860+ NameBindingKind :: Ambiguity { b1, b2 } => {
18701861 self . ambiguity_errors . push ( AmbiguityError {
1871- span : span , name : ident. name , lexical : false , b1 : b1 , b2 : b2 , legacy ,
1862+ span, name : ident. name , lexical : false , b1, b2,
18721863 } ) ;
1873- if legacy {
1874- self . record_use ( ident, ns, b1, span) ;
1875- }
1876- !legacy
1864+ true
18771865 }
18781866 _ => false
18791867 }
@@ -4074,7 +4062,7 @@ impl<'a> Resolver<'a> {
40744062 self . report_proc_macro_import ( krate) ;
40754063 let mut reported_spans = FxHashSet ( ) ;
40764064
4077- for & AmbiguityError { span, name, b1, b2, lexical, legacy } in & self . ambiguity_errors {
4065+ for & AmbiguityError { span, name, b1, b2, lexical } in & self . ambiguity_errors {
40784066 if !reported_spans. insert ( span) { continue }
40794067 let participle = |binding : & NameBinding | {
40804068 if binding. is_import ( ) { "imported" } else { "defined" }
@@ -4090,27 +4078,15 @@ impl<'a> Resolver<'a> {
40904078 format ! ( "macro-expanded {} do not shadow when used in a macro invocation path" ,
40914079 if b1. is_import( ) { "imports" } else { "items" } )
40924080 } ;
4093- if legacy {
4094- let id = match b2. kind {
4095- NameBindingKind :: Import { directive, .. } => directive. id ,
4096- _ => unreachable ! ( ) ,
4097- } ;
4098- let mut span = MultiSpan :: from_span ( span) ;
4099- span. push_span_label ( b1. span , msg1) ;
4100- span. push_span_label ( b2. span , msg2) ;
4101- let msg = format ! ( "`{}` is ambiguous" , name) ;
4102- self . session . buffer_lint ( lint:: builtin:: LEGACY_IMPORTS , id, span, & msg) ;
4103- } else {
4104- let mut err =
4105- struct_span_err ! ( self . session, span, E0659 , "`{}` is ambiguous" , name) ;
4106- err. span_note ( b1. span , & msg1) ;
4107- match b2. def ( ) {
4108- Def :: Macro ( ..) if b2. span == DUMMY_SP =>
4109- err. note ( & format ! ( "`{}` is also a builtin macro" , name) ) ,
4110- _ => err. span_note ( b2. span , & msg2) ,
4111- } ;
4112- err. note ( & note) . emit ( ) ;
4113- }
4081+
4082+ let mut err = struct_span_err ! ( self . session, span, E0659 , "`{}` is ambiguous" , name) ;
4083+ err. span_note ( b1. span , & msg1) ;
4084+ match b2. def ( ) {
4085+ Def :: Macro ( ..) if b2. span == DUMMY_SP =>
4086+ err. note ( & format ! ( "`{}` is also a builtin macro" , name) ) ,
4087+ _ => err. span_note ( b2. span , & msg2) ,
4088+ } ;
4089+ err. note ( & note) . emit ( ) ;
41144090 }
41154091
41164092 for & PrivacyError ( span, name, binding) in & self . privacy_errors {
@@ -4261,12 +4237,6 @@ impl<'a> Resolver<'a> {
42614237 self . name_already_seen . insert ( name, span) ;
42624238 }
42634239
4264- fn warn_legacy_self_import ( & self , directive : & ' a ImportDirective < ' a > ) {
4265- let ( id, span) = ( directive. id , directive. span ) ;
4266- let msg = "`self` no longer imports values" ;
4267- self . session . buffer_lint ( lint:: builtin:: LEGACY_IMPORTS , id, span, msg) ;
4268- }
4269-
42704240 fn check_proc_macro_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
42714241 if self . proc_macro_enabled { return ; }
42724242
0 commit comments