We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
token::Eof
1 parent f6eaaf3 commit a02c18aCopy full SHA for a02c18a
src/libsyntax/parse/parser.rs
@@ -223,7 +223,7 @@ impl TokenCursor {
223
self.frame = frame;
224
continue
225
} else {
226
- return TokenAndSpan { tok: token::Eof, sp: self.frame.span }
+ return TokenAndSpan { tok: token::Eof, sp: syntax_pos::DUMMY_SP }
227
};
228
229
match tree {
@@ -448,10 +448,14 @@ impl<'a> Parser<'a> {
448
}
449
450
fn next_tok(&mut self) -> TokenAndSpan {
451
- match self.desugar_doc_comments {
+ let mut next = match self.desugar_doc_comments {
452
true => self.token_cursor.next_desugared(),
453
false => self.token_cursor.next(),
454
+ };
455
+ if next.sp == syntax_pos::DUMMY_SP {
456
+ next.sp = self.prev_span;
457
458
+ next
459
460
461
/// Convert a token to a string using self's reader
0 commit comments