@@ -258,6 +258,7 @@ pub struct Parser<'a> {
258258    pub  tokens_consumed :  usize , 
259259    pub  restrictions :  Restrictions , 
260260    pub  quote_depth :  usize ,  // not (yet) related to the quasiquoter 
261+     parsing_token_tree :  bool , 
261262    pub  reader :  Box < Reader +' a > , 
262263    /// The set of seen errors about obsolete syntax. Used to suppress 
263264/// extra detail when the same error is seen twice 
@@ -374,6 +375,7 @@ impl<'a> Parser<'a> {
374375            tokens_consumed :  0 , 
375376            restrictions :  Restrictions :: empty ( ) , 
376377            quote_depth :  0 , 
378+             parsing_token_tree :  false , 
377379            obsolete_set :  HashSet :: new ( ) , 
378380            mod_path_stack :  Vec :: new ( ) , 
379381            filename :  filename, 
@@ -2663,7 +2665,7 @@ impl<'a> Parser<'a> {
26632665    } 
26642666
26652667    pub  fn  check_unknown_macro_variable ( & mut  self )  { 
2666-         if  self . quote_depth  == 0  { 
2668+         if  self . quote_depth  == 0  && ! self . parsing_token_tree   { 
26672669            match  self . token  { 
26682670                token:: SubstNt ( name)  =>
26692671                    self . fatal ( & format ! ( "unknown macro variable `{}`" ,  name) ) . emit ( ) , 
@@ -2723,6 +2725,7 @@ impl<'a> Parser<'a> {
27232725                Err ( err) 
27242726            } , 
27252727            token:: OpenDelim ( delim)  => { 
2728+                 let  parsing_token_tree = :: std:: mem:: replace ( & mut  self . parsing_token_tree ,  true ) ; 
27262729                // The span for beginning of the delimited section 
27272730                let  pre_span = self . span ; 
27282731
@@ -2787,6 +2790,7 @@ impl<'a> Parser<'a> {
27872790                    _ => { } 
27882791                } 
27892792
2793+                 self . parsing_token_tree  = parsing_token_tree; 
27902794                Ok ( TokenTree :: Delimited ( span,  Rc :: new ( Delimited  { 
27912795                    delim :  delim, 
27922796                    open_span :  open_span, 
0 commit comments