about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-04-22 04:10:15 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-04-22 04:33:30 +0300
commit6a4e0b3fae419f8646da2f2327c6b7e947beafba (patch)
treef9caed983f44752d40aac8734e154be8f8e1af58 /src/libsyntax/parse
parentaa7ce896f2c41550f7f6cf3dadb21bacc69cc912 (diff)
downloadrust-6a4e0b3fae419f8646da2f2327c6b7e947beafba.tar.gz
rust-6a4e0b3fae419f8646da2f2327c6b7e947beafba.zip
parser: Do not override syntactic context for dummy spans
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index a7a9ce74512..3e1de923695 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -589,7 +589,8 @@ impl<'a> Parser<'a> {
             self.token_cursor.next()
         };
         if next.sp == syntax_pos::DUMMY_SP {
-            next.sp = self.prev_span;
+            // Tweak the location for better diagnostics, but keep syntactic context intact.
+            next.sp = self.prev_span.with_ctxt(next.sp.ctxt());
         }
         next
     }