about summary refs log tree commit diff
path: root/src/librustc_parse/lib.rs
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2020-05-19 16:56:20 -0400
committerAaron Hill <aa1ronham@gmail.com>2020-05-24 15:54:48 -0400
commit14382c6437140bdc2ffaa66edd66f5726a88f156 (patch)
tree88e9edc8b735786efb9071163d749722ab149788 /src/librustc_parse/lib.rs
parentff991d60349201a90ca15202dd0323ebdfab8745 (diff)
Collect tokens for `ast::Expr`
Diffstat (limited to 'src/librustc_parse/lib.rs')
-rw-r--r--src/librustc_parse/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs
index 0c817a71281..8ca3f6c5768 100644
--- a/src/librustc_parse/lib.rs
+++ b/src/librustc_parse/lib.rs
@@ -272,6 +272,12 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
             Some(tokenstream::TokenTree::token(token::Lifetime(ident.name), ident.span).into())
         }
         Nonterminal::NtTT(ref tt) => Some(tt.clone().into()),
+        Nonterminal::NtExpr(ref expr) => {
+            if expr.tokens.is_none() {
+                debug!("missing tokens for expr {:?}", expr);
+            }
+            prepend_attrs(sess, &expr.attrs, expr.tokens.as_ref(), span)
+        }
         _ => None,
     };
 
@@ -311,6 +317,8 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
             "cached tokens found, but they're not \"probably equal\", \
                 going with stringified version"
         );
+        info!("cached tokens: {:?}", tokens);
+        info!("reparsed tokens: {:?}", tokens_for_real);
     }
     tokens_for_real
 }