@@ -41,7 +41,7 @@ use rustc_metadata::cstore::CStore;
4141use syntax:: source_map:: SourceMap ;
4242use syntax:: ext:: hygiene:: { Mark , Transparency , SyntaxContext } ;
4343use syntax:: ast:: { self , Name , NodeId , Ident , FloatTy , IntTy , UintTy } ;
44- use syntax:: ext:: base:: SyntaxExtension ;
44+ use syntax:: ext:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
4545use syntax:: ext:: base:: Determinacy :: { self , Determined , Undetermined } ;
4646use syntax:: ext:: base:: MacroKind ;
4747use syntax:: symbol:: { Symbol , kw, sym} ;
@@ -1668,6 +1668,7 @@ pub struct Resolver<'a> {
16681668 macro_use_prelude : FxHashMap < Name , & ' a NameBinding < ' a > > ,
16691669 pub all_macros : FxHashMap < Name , Res > ,
16701670 macro_map : FxHashMap < DefId , Lrc < SyntaxExtension > > ,
1671+ non_macro_attrs : [ Lrc < SyntaxExtension > ; 2 ] ,
16711672 macro_defs : FxHashMap < Mark , DefId > ,
16721673 local_macro_def_scopes : FxHashMap < NodeId , Module < ' a > > ,
16731674
@@ -1941,6 +1942,10 @@ impl<'a> Resolver<'a> {
19411942 let mut macro_defs = FxHashMap :: default ( ) ;
19421943 macro_defs. insert ( Mark :: root ( ) , root_def_id) ;
19431944
1945+ let non_macro_attr = |mark_used| Lrc :: new ( SyntaxExtension :: default (
1946+ SyntaxExtensionKind :: NonMacroAttr { mark_used } , session. edition ( )
1947+ ) ) ;
1948+
19441949 Resolver {
19451950 session,
19461951
@@ -2014,6 +2019,7 @@ impl<'a> Resolver<'a> {
20142019 macro_use_prelude : FxHashMap :: default ( ) ,
20152020 all_macros : FxHashMap :: default ( ) ,
20162021 macro_map : FxHashMap :: default ( ) ,
2022+ non_macro_attrs : [ non_macro_attr ( false ) , non_macro_attr ( true ) ] ,
20172023 invocations,
20182024 macro_defs,
20192025 local_macro_def_scopes : FxHashMap :: default ( ) ,
@@ -2030,6 +2036,10 @@ impl<'a> Resolver<'a> {
20302036 Default :: default ( )
20312037 }
20322038
2039+ fn non_macro_attr ( & self , mark_used : bool ) -> Lrc < SyntaxExtension > {
2040+ self . non_macro_attrs [ mark_used as usize ] . clone ( )
2041+ }
2042+
20332043 /// Runs the function on each namespace.
20342044 fn per_ns < F : FnMut ( & mut Self , Namespace ) > ( & mut self , mut f : F ) {
20352045 f ( self , TypeNS ) ;
0 commit comments