Skip to content

Commit 880318c

Browse files
committed
Remove Eof sanity check in Parser::inlined_bump_with.
A Google search of the error message fails to return any relevant resuts, suggesting this has never occurred in practice. And removeing it reduces instruction counts by up to 2% on some benchmarks.
1 parent d2b9bbb commit 880318c

File tree

1 file changed

+0
-6
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+0
-6
lines changed

compiler/rustc_parse/src/parser/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,6 @@ impl<'a> Parser<'a> {
984984
/// This always-inlined version should only be used on hot code paths.
985985
#[inline(always)]
986986
fn inlined_bump_with(&mut self, (next_token, next_spacing): (Token, Spacing)) {
987-
// Bumping after EOF is a bad sign, usually an infinite loop.
988-
if self.prev_token.kind == TokenKind::Eof {
989-
let msg = "attempted to bump the parser past EOF (may be stuck in a loop)";
990-
self.span_bug(self.token.span, msg);
991-
}
992-
993987
// Update the current and previous tokens.
994988
self.prev_token = mem::replace(&mut self.token, next_token);
995989
self.token_spacing = next_spacing;

0 commit comments

Comments
 (0)