@@ -17,7 +17,7 @@ use ext::placeholders;
1717use ext:: tt:: macro_parser:: { Success , Error , Failure } ;
1818use ext:: tt:: macro_parser:: { MatchedSeq , MatchedNonterminal } ;
1919use ext:: tt:: macro_parser:: { parse, parse_failure_msg} ;
20- use parse:: ParseSess ;
20+ use parse:: { Directory , ParseSess } ;
2121use parse:: lexer:: new_tt_reader;
2222use parse:: parser:: Parser ;
2323use parse:: token:: { self , NtTT , Token } ;
@@ -116,12 +116,13 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
116116 // rhs has holes ( `$id` and `$(...)` that need filled)
117117 let trncbr =
118118 new_tt_reader ( & cx. parse_sess . span_diagnostic , Some ( named_matches) , rhs) ;
119- let mut p = Parser :: new ( cx. parse_sess ( ) , Box :: new ( trncbr) ) ;
120- let module = & cx. current_expansion . module ;
121- p. directory . path = module. directory . clone ( ) ;
122- p. directory . ownership = cx. current_expansion . directory_ownership ;
123- p. root_module_name =
124- module. mod_path . last ( ) . map ( |id| ( * id. name . as_str ( ) ) . to_owned ( ) ) ;
119+ let directory = Directory {
120+ path : cx. current_expansion . module . directory . clone ( ) ,
121+ ownership : cx. current_expansion . directory_ownership ,
122+ } ;
123+ let mut p = Parser :: new ( cx. parse_sess ( ) , Box :: new ( trncbr) , Some ( directory) , false ) ;
124+ p. root_module_name = cx. current_expansion . module . mod_path . last ( )
125+ . map ( |id| ( * id. name . as_str ( ) ) . to_owned ( ) ) ;
125126
126127 p. check_unknown_macro_variable ( ) ;
127128 // Let the context choose how to interpret the result.
@@ -222,7 +223,7 @@ pub fn compile(sess: &ParseSess, def: &ast::MacroDef) -> SyntaxExtension {
222223 // Parse the macro_rules! invocation (`none` is for no interpolations):
223224 let arg_reader = new_tt_reader ( & sess. span_diagnostic , None , def. body . clone ( ) ) ;
224225
225- let argument_map = match parse ( sess, arg_reader, & argument_gram) {
226+ let argument_map = match parse ( sess, arg_reader, & argument_gram, None ) {
226227 Success ( m) => m,
227228 Failure ( sp, tok) => {
228229 let s = parse_failure_msg ( tok) ;
0 commit comments