@@ -5,7 +5,7 @@ use rustc_ast::ptr::P;
55use rustc_ast:: token:: { self , Nonterminal } ;
66use rustc_ast:: tokenstream:: { CanSynthesizeMissingTokens , LazyTokenStream , TokenStream } ;
77use rustc_ast:: visit:: { AssocCtxt , Visitor } ;
8- use rustc_ast:: { self as ast, AstLike , Attribute , NodeId , PatKind } ;
8+ use rustc_ast:: { self as ast, AstLike , Attribute , Item , NodeId , PatKind } ;
99use rustc_attr:: { self as attr, Deprecation , Stability } ;
1010use rustc_data_structures:: fx:: FxHashMap ;
1111use rustc_data_structures:: sync:: { self , Lrc } ;
@@ -925,6 +925,9 @@ pub struct ExpansionData {
925925 pub prior_type_ascription : Option < ( Span , bool ) > ,
926926}
927927
928+ type OnExternModLoaded < ' a > =
929+ Option < & ' a dyn Fn ( Ident , Vec < Attribute > , Vec < P < Item > > , Span ) -> ( Vec < Attribute > , Vec < P < Item > > ) > ;
930+
928931/// One of these is made during expansion and incrementally updated as we go;
929932/// when a macro expansion occurs, the resulting nodes have the `backtrace()
930933/// -> expn_data` of their expansion context stored into their span.
@@ -942,15 +945,15 @@ pub struct ExtCtxt<'a> {
942945 /// Called directly after having parsed an external `mod foo;` in expansion.
943946 ///
944947 /// `Ident` is the module name.
945- pub ( super ) extern_mod_loaded : Option < & ' a dyn Fn ( & ast :: Crate , Ident ) > ,
948+ pub ( super ) extern_mod_loaded : OnExternModLoaded < ' a > ,
946949}
947950
948951impl < ' a > ExtCtxt < ' a > {
949952 pub fn new (
950953 sess : & ' a Session ,
951954 ecfg : expand:: ExpansionConfig < ' a > ,
952955 resolver : & ' a mut dyn ResolverExpand ,
953- extern_mod_loaded : Option < & ' a dyn Fn ( & ast :: Crate , Ident ) > ,
956+ extern_mod_loaded : OnExternModLoaded < ' a > ,
954957 ) -> ExtCtxt < ' a > {
955958 ExtCtxt {
956959 sess,
0 commit comments