about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-06 03:28:09 +0100
committerGitHub <noreply@github.com>2019-11-06 03:28:09 +0100
commite5da1a12e745e0d92cfae421673faac4fd5e4069 (patch)
tree7899e2184908bc21c9eb2b07698513ea1982030c /src/libsyntax/parse
parent5c4a595ff09d08c46ee3b23d343da47b0d12243d (diff)
parent90f891d8ae9073623769fac18f00c4f1031fcb59 (diff)
downloadrust-e5da1a12e745e0d92cfae421673faac4fd5e4069.tar.gz
rust-e5da1a12e745e0d92cfae421673faac4fd5e4069.zip
Rollup merge of #66054 - petrochenkov:delspan, r=estebank
syntax: Avoid span arithmetic for delimiter tokens

The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it.
Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly.
If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries.

Fixes https://github.com/rust-lang/rust/issues/62524
r? @estebank
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e81d4573b73..7652c730e51 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -209,12 +209,12 @@ impl TokenCursor {
         loop {
             let tree = if !self.frame.open_delim {
                 self.frame.open_delim = true;
-                TokenTree::open_tt(self.frame.span.open, self.frame.delim)
+                TokenTree::open_tt(self.frame.span, self.frame.delim)
             } else if let Some(tree) = self.frame.tree_cursor.next() {
                 tree
             } else if !self.frame.close_delim {
                 self.frame.close_delim = true;
-                TokenTree::close_tt(self.frame.span.close, self.frame.delim)
+                TokenTree::close_tt(self.frame.span, self.frame.delim)
             } else if let Some(frame) = self.stack.pop() {
                 self.frame = frame;
                 continue