@@ -80,7 +80,7 @@ use std::mem::replace;
8080use rustc_data_structures:: sync:: Lrc ;
8181
8282use resolve_imports:: { ImportDirective , ImportDirectiveSubclass , NameResolution , ImportResolver } ;
83- use macros:: { InvocationData , LegacyBinding , LegacyScope , MacroBinding } ;
83+ use macros:: { InvocationData , LegacyBinding , MacroBinding } ;
8484
8585// NB: This module needs to be declared first so diagnostics are
8686// registered before they are used.
@@ -1399,23 +1399,18 @@ pub struct Resolver<'a, 'b: 'a> {
13991399 /// crate-local macro expanded `macro_export` referred to by a module-relative path
14001400 macro_expanded_macro_export_errors : BTreeSet < ( Span , Span ) > ,
14011401
1402- gated_errors : FxHashSet < Span > ,
14031402 disallowed_shadowing : Vec < & ' a LegacyBinding < ' a > > ,
14041403
14051404 arenas : & ' a ResolverArenas < ' a > ,
14061405 dummy_binding : & ' a NameBinding < ' a > ,
1407- /// true if `#![feature(use_extern_macros)]`
1408- use_extern_macros : bool ,
14091406
14101407 crate_loader : & ' a mut CrateLoader < ' b > ,
14111408 macro_names : FxHashSet < Ident > ,
14121409 macro_prelude : FxHashMap < Name , & ' a NameBinding < ' a > > ,
14131410 pub all_macros : FxHashMap < Name , Def > ,
1414- lexical_macro_resolutions : Vec < ( Ident , & ' a Cell < LegacyScope < ' a > > ) > ,
14151411 macro_map : FxHashMap < DefId , Lrc < SyntaxExtension > > ,
14161412 macro_defs : FxHashMap < Mark , DefId > ,
14171413 local_macro_def_scopes : FxHashMap < NodeId , Module < ' a > > ,
1418- macro_exports : Vec < Export > , // FIXME: Remove when `use_extern_macros` is stabilized
14191414 pub whitelisted_legacy_custom_derives : Vec < Name > ,
14201415 pub found_unresolved_macro : bool ,
14211416
@@ -1657,8 +1652,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
16571652 invocations. insert ( Mark :: root ( ) ,
16581653 arenas. alloc_invocation_data ( InvocationData :: root ( graph_root) ) ) ;
16591654
1660- let features = session. features_untracked ( ) ;
1661-
16621655 let mut macro_defs = FxHashMap ( ) ;
16631656 macro_defs. insert ( Mark :: root ( ) , root_def_id) ;
16641657
@@ -1717,7 +1710,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17171710 ambiguity_errors : Vec :: new ( ) ,
17181711 use_injections : Vec :: new ( ) ,
17191712 proc_mac_errors : Vec :: new ( ) ,
1720- gated_errors : FxHashSet ( ) ,
17211713 disallowed_shadowing : Vec :: new ( ) ,
17221714 macro_expanded_macro_export_errors : BTreeSet :: new ( ) ,
17231715
@@ -1729,15 +1721,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17291721 vis : ty:: Visibility :: Public ,
17301722 } ) ,
17311723
1732- use_extern_macros : features. use_extern_macros ( ) ,
1733-
17341724 crate_loader,
17351725 macro_names : FxHashSet ( ) ,
17361726 macro_prelude : FxHashMap ( ) ,
17371727 all_macros : FxHashMap ( ) ,
1738- lexical_macro_resolutions : Vec :: new ( ) ,
17391728 macro_map : FxHashMap ( ) ,
1740- macro_exports : Vec :: new ( ) ,
17411729 invocations,
17421730 macro_defs,
17431731 local_macro_def_scopes : FxHashMap ( ) ,
@@ -1770,9 +1758,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
17701758 fn per_ns < F : FnMut ( & mut Self , Namespace ) > ( & mut self , mut f : F ) {
17711759 f ( self , TypeNS ) ;
17721760 f ( self , ValueNS ) ;
1773- if self . use_extern_macros {
1774- f ( self , MacroNS ) ;
1775- }
1761+ f ( self , MacroNS ) ;
17761762 }
17771763
17781764 fn macro_def ( & self , mut ctxt : SyntaxContext ) -> DefId {
@@ -2186,11 +2172,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
21862172
21872173 fn resolve_item ( & mut self , item : & Item ) {
21882174 let name = item. ident . name ;
2189-
21902175 debug ! ( "(resolving item) resolving {}" , name) ;
21912176
2192- self . check_proc_macro_attrs ( & item. attrs ) ;
2193-
21942177 match item. node {
21952178 ItemKind :: Enum ( _, ref generics) |
21962179 ItemKind :: Ty ( _, ref generics) |
@@ -2218,8 +2201,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
22182201 walk_list ! ( this, visit_param_bound, bounds) ;
22192202
22202203 for trait_item in trait_items {
2221- this. check_proc_macro_attrs ( & trait_item. attrs ) ;
2222-
22232204 let type_parameters = HasTypeParameters ( & trait_item. generics ,
22242205 TraitOrImplItemRibKind ) ;
22252206 this. with_type_parameter_rib ( type_parameters, |this| {
@@ -2498,7 +2479,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
24982479 this. visit_generics ( generics) ;
24992480 this. with_current_self_type ( self_type, |this| {
25002481 for impl_item in impl_items {
2501- this. check_proc_macro_attrs ( & impl_item. attrs ) ;
25022482 this. resolve_visibility ( & impl_item. vis ) ;
25032483
25042484 // We also need a new scope for the impl item type parameters.
@@ -4488,10 +4468,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
44884468 }
44894469
44904470 fn report_shadowing_errors ( & mut self ) {
4491- for ( ident, scope) in replace ( & mut self . lexical_macro_resolutions , Vec :: new ( ) ) {
4492- self . resolve_legacy_scope ( scope, ident, true ) ;
4493- }
4494-
44954471 let mut reported_errors = FxHashSet ( ) ;
44964472 for binding in replace ( & mut self . disallowed_shadowing , Vec :: new ( ) ) {
44974473 if self . resolve_legacy_scope ( & binding. parent , binding. ident , false ) . is_some ( ) &&
@@ -4612,36 +4588,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
46124588 err. emit ( ) ;
46134589 self . name_already_seen . insert ( name, span) ;
46144590 }
4615-
4616- fn check_proc_macro_attrs ( & mut self , attrs : & [ ast:: Attribute ] ) {
4617- if self . use_extern_macros { return ; }
4618-
4619- for attr in attrs {
4620- if attr. path . segments . len ( ) > 1 {
4621- continue
4622- }
4623- let ident = attr. path . segments [ 0 ] . ident ;
4624- let result = self . resolve_lexical_macro_path_segment ( ident,
4625- MacroNS ,
4626- false ,
4627- false ,
4628- true ,
4629- attr. path . span ) ;
4630- if let Ok ( binding) = result {
4631- if let SyntaxExtension :: AttrProcMacro ( ..) = * binding. binding ( ) . get_macro ( self ) {
4632- attr:: mark_known ( attr) ;
4633-
4634- let msg = "attribute procedural macros are experimental" ;
4635- let feature = "use_extern_macros" ;
4636-
4637- feature_err ( & self . session . parse_sess , feature,
4638- attr. span , GateIssue :: Language , msg)
4639- . span_label ( binding. span ( ) , "procedural macro imported here" )
4640- . emit ( ) ;
4641- }
4642- }
4643- }
4644- }
46454591}
46464592
46474593fn is_self_type ( path : & [ Ident ] , namespace : Namespace ) -> bool {
0 commit comments