about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-22 16:58:12 +0000
committerbors <bors@rust-lang.org>2018-04-22 16:58:12 +0000
commitff48277add047928dcd19d64ffe93c46b0612a4d (patch)
treeaca5053c43bbdff92d3f292e7f77bb5d9d5a2373 /src/libsyntax/parse/parser.rs
parent88873965137e752407d5797e7319410df2554f0c (diff)
parent6a4e0b3fae419f8646da2f2327c6b7e947beafba (diff)
downloadrust-ff48277add047928dcd19d64ffe93c46b0612a4d.tar.gz
rust-ff48277add047928dcd19d64ffe93c46b0612a4d.zip
Auto merge of #50152 - petrochenkov:nooverhyg, r=alexcrichton
parser: Do not override syntactic context for dummy spans

Fixes https://github.com/rust-lang/rust/issues/50061

https://github.com/rust-lang/rust/commit/e2afefd80bf779bc3c6f697a3c6cc3a476993602 seemingly did everything right, but uncovered a preexisting bug.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-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
     }