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

e2afefd80b seemingly did everything right, but uncovered a preexisting bug.
This commit is contained in:
bors 2018-04-22 16:58:12 +00:00
commit ff48277add
3 changed files with 55 additions and 1 deletions

View file

@ -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
}