From 6a4e0b3fae419f8646da2f2327c6b7e947beafba Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 22 Apr 2018 04:10:15 +0300 Subject: parser: Do not override syntactic context for dummy spans --- src/libsyntax/parse/parser.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/parse/parser.rs') 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 } -- cgit 1.4.1-3-g733a5