diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-20 14:52:54 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-20 14:52:54 +1000 |
| commit | 880318c70a3cf676acae9c1e61ac6519f7f67f46 (patch) | |
| tree | a43b154492ae6b708e879f8200408975ee4d0ea7 | |
| parent | d2b9bbbf783e2921fbca28eae06314e8b7f8a89a (diff) | |
| download | rust-880318c70a3cf676acae9c1e61ac6519f7f67f46.tar.gz rust-880318c70a3cf676acae9c1e61ac6519f7f67f46.zip | |
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.
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 28be9f4b592..581d706f682 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -984,12 +984,6 @@ impl<'a> Parser<'a> { /// This always-inlined version should only be used on hot code paths. #[inline(always)] fn inlined_bump_with(&mut self, (next_token, next_spacing): (Token, Spacing)) { - // Bumping after EOF is a bad sign, usually an infinite loop. - if self.prev_token.kind == TokenKind::Eof { - let msg = "attempted to bump the parser past EOF (may be stuck in a loop)"; - self.span_bug(self.token.span, msg); - } - // Update the current and previous tokens. self.prev_token = mem::replace(&mut self.token, next_token); self.token_spacing = next_spacing; |
