@@ -5,7 +5,7 @@ use rustc_ast::ptr::P;
5
5
use rustc_ast:: token:: { self , Nonterminal } ;
6
6
use rustc_ast:: tokenstream:: { CanSynthesizeMissingTokens , LazyTokenStream , TokenStream } ;
7
7
use 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 } ;
9
9
use rustc_attr:: { self as attr, Deprecation , Stability } ;
10
10
use rustc_data_structures:: fx:: FxHashMap ;
11
11
use rustc_data_structures:: sync:: { self , Lrc } ;
@@ -925,6 +925,9 @@ pub struct ExpansionData {
925
925
pub prior_type_ascription : Option < ( Span , bool ) > ,
926
926
}
927
927
928
+ type OnExternModLoaded < ' a > =
929
+ Option < & ' a dyn Fn ( Ident , Vec < Attribute > , Vec < P < Item > > , Span ) -> ( Vec < Attribute > , Vec < P < Item > > ) > ;
930
+
928
931
/// One of these is made during expansion and incrementally updated as we go;
929
932
/// when a macro expansion occurs, the resulting nodes have the `backtrace()
930
933
/// -> expn_data` of their expansion context stored into their span.
@@ -942,15 +945,15 @@ pub struct ExtCtxt<'a> {
942
945
/// Called directly after having parsed an external `mod foo;` in expansion.
943
946
///
944
947
/// `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 > ,
946
949
}
947
950
948
951
impl < ' a > ExtCtxt < ' a > {
949
952
pub fn new (
950
953
sess : & ' a Session ,
951
954
ecfg : expand:: ExpansionConfig < ' a > ,
952
955
resolver : & ' a mut dyn ResolverExpand ,
953
- extern_mod_loaded : Option < & ' a dyn Fn ( & ast :: Crate , Ident ) > ,
956
+ extern_mod_loaded : OnExternModLoaded < ' a > ,
954
957
) -> ExtCtxt < ' a > {
955
958
ExtCtxt {
956
959
sess,
0 commit comments