about summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-17 09:30:43 -0700
committerAlex Crichton <alex@alexcrichton.com>2018-05-18 10:36:24 -0700
commit0ee031ab9668c52c05e189c4e9380901d7d1e579 (patch)
treea24008d8ddeb80756c7e33da37bd268630c010cb /src/libsyntax/parse/token.rs
parentba64edb3edb9d54f24507255d6aaca5a567e2f40 (diff)
downloadrust-0ee031ab9668c52c05e189c4e9380901d7d1e579.tar.gz
rust-0ee031ab9668c52c05e189c4e9380901d7d1e579.zip
rustc: Fix joint-ness of stringified token-streams
This commit fixes `StringReader`'s parsing of tokens which have been stringified
through procedural macros. Whether or not a token tree is joint is defined by
span information, but when working with procedural macros these spans are often
dummy and/or overridden which means that they end up considering all operators
joint if they can!

The fix here is to track the raw source span as opposed to the overridden span.
With this information we can more accurately classify `Punct` structs as either
joint or not.

Closes #50700
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 5575614a4d4..034be6a6864 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -581,6 +581,8 @@ impl Token {
             if tokens.probably_equal_for_proc_macro(&tokens_for_real) {
                 return tokens
             }
+            info!("cached tokens found, but they're not \"probably equal\", \
+                   going with stringified version");
         }
         return tokens_for_real
     }