@@ -1224,12 +1224,10 @@ enum NameBindingKind<'a> {
12241224 binding : & ' a NameBinding < ' a > ,
12251225 directive : & ' a ImportDirective < ' a > ,
12261226 used : Cell < bool > ,
1227- legacy_self_import : bool ,
12281227 } ,
12291228 Ambiguity {
12301229 b1 : & ' a NameBinding < ' a > ,
12311230 b2 : & ' a NameBinding < ' a > ,
1232- legacy : bool ,
12331231 }
12341232}
12351233
@@ -1251,15 +1249,13 @@ struct AmbiguityError<'a> {
12511249 lexical : bool ,
12521250 b1 : & ' a NameBinding < ' a > ,
12531251 b2 : & ' a NameBinding < ' a > ,
1254- legacy : bool ,
12551252}
12561253
12571254impl < ' a > NameBinding < ' a > {
12581255 fn module ( & self ) -> Option < Module < ' a > > {
12591256 match self . kind {
12601257 NameBindingKind :: Module ( module) => Some ( module) ,
12611258 NameBindingKind :: Import { binding, .. } => binding. module ( ) ,
1262- NameBindingKind :: Ambiguity { legacy : true , b1, .. } => b1. module ( ) ,
12631259 _ => None ,
12641260 }
12651261 }
@@ -1269,7 +1265,6 @@ impl<'a> NameBinding<'a> {
12691265 NameBindingKind :: Def ( def) => def,
12701266 NameBindingKind :: Module ( module) => module. def ( ) . unwrap ( ) ,
12711267 NameBindingKind :: Import { binding, .. } => binding. def ( ) ,
1272- NameBindingKind :: Ambiguity { legacy : true , b1, .. } => b1. def ( ) ,
12731268 NameBindingKind :: Ambiguity { .. } => Def :: Err ,
12741269 }
12751270 }
@@ -1852,27 +1847,20 @@ impl<'a> Resolver<'a> {
18521847 fn record_use ( & mut self , ident : Ident , ns : Namespace , binding : & ' a NameBinding < ' a > , span : Span )
18531848 -> bool /* true if an error was reported */ {
18541849 match binding. kind {
1855- NameBindingKind :: Import { directive, binding, ref used, legacy_self_import }
1850+ NameBindingKind :: Import { directive, binding, ref used }
18561851 if !used. get ( ) => {
18571852 used. set ( true ) ;
18581853 directive. used . set ( true ) ;
1859- if legacy_self_import {
1860- self . warn_legacy_self_import ( directive) ;
1861- return false ;
1862- }
18631854 self . used_imports . insert ( ( directive. id , ns) ) ;
18641855 self . add_to_glob_map ( directive. id , ident) ;
18651856 self . record_use ( ident, ns, binding, span)
18661857 }
18671858 NameBindingKind :: Import { .. } => false ,
1868- NameBindingKind :: Ambiguity { b1, b2, legacy } => {
1859+ NameBindingKind :: Ambiguity { b1, b2 } => {
18691860 self . ambiguity_errors . push ( AmbiguityError {
1870- span : span , name : ident. name , lexical : false , b1 : b1 , b2 : b2 , legacy ,
1861+ span, name : ident. name , lexical : false , b1, b2,
18711862 } ) ;
1872- if legacy {
1873- self . record_use ( ident, ns, b1, span) ;
1874- }
1875- !legacy
1863+ true
18761864 }
18771865 _ => false
18781866 }
@@ -4128,7 +4116,7 @@ impl<'a> Resolver<'a> {
41284116 self . report_proc_macro_import ( krate) ;
41294117 let mut reported_spans = FxHashSet ( ) ;
41304118
4131- for & AmbiguityError { span, name, b1, b2, lexical, legacy } in & self . ambiguity_errors {
4119+ for & AmbiguityError { span, name, b1, b2, lexical } in & self . ambiguity_errors {
41324120 if !reported_spans. insert ( span) { continue }
41334121 let participle = |binding : & NameBinding | {
41344122 if binding. is_import ( ) { "imported" } else { "defined" }
@@ -4144,27 +4132,15 @@ impl<'a> Resolver<'a> {
41444132 format ! ( "macro-expanded {} do not shadow when used in a macro invocation path" ,
41454133 if b1. is_import( ) { "imports" } else { "items" } )
41464134 } ;
4147- if legacy {
4148- let id = match b2. kind {
4149- NameBindingKind :: Import { directive, .. } => directive. id ,
4150- _ => unreachable ! ( ) ,
4151- } ;
4152- let mut span = MultiSpan :: from_span ( span) ;
4153- span. push_span_label ( b1. span , msg1) ;
4154- span. push_span_label ( b2. span , msg2) ;
4155- let msg = format ! ( "`{}` is ambiguous" , name) ;
4156- self . session . buffer_lint ( lint:: builtin:: LEGACY_IMPORTS , id, span, & msg) ;
4157- } else {
4158- let mut err =
4159- struct_span_err ! ( self . session, span, E0659 , "`{}` is ambiguous" , name) ;
4160- err. span_note ( b1. span , & msg1) ;
4161- match b2. def ( ) {
4162- Def :: Macro ( ..) if b2. span == DUMMY_SP =>
4163- err. note ( & format ! ( "`{}` is also a builtin macro" , name) ) ,
4164- _ => err. span_note ( b2. span , & msg2) ,
4165- } ;
4166- err. note ( & note) . emit ( ) ;
4167- }
4135+
4136+ let mut err = struct_span_err ! ( self . session, span, E0659 , "`{}` is ambiguous" , name) ;
4137+ err. span_note ( b1. span , & msg1) ;
4138+ match b2. def ( ) {
4139+ Def :: Macro ( ..) if b2. span == DUMMY_SP =>
4140+ err. note ( & format ! ( "`{}` is also a builtin macro" , name) ) ,
4141+ _ => err. span_note ( b2. span , & msg2) ,
4142+ } ;
4143+ err. note ( & note) . emit ( ) ;
41684144 }
41694145
41704146 for & PrivacyError ( span, name, binding) in & self . privacy_errors {
@@ -4315,12 +4291,6 @@ impl<'a> Resolver<'a> {
43154291 self . name_already_seen . insert ( name, span) ;
43164292 }
43174293
4318- fn warn_legacy_self_import ( & self , directive : & ' a ImportDirective < ' a > ) {
4319- let ( id, span) = ( directive. id , directive. span ) ;
4320- let msg = "`self` no longer imports values" ;
4321- self . session . buffer_lint ( lint:: builtin:: LEGACY_IMPORTS , id, span, msg) ;
4322- }
4323-
43244294 fn check_proc_macro_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
43254295 if self . proc_macro_enabled { return ; }
43264296
0 commit comments