We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fcac14 commit 5025113Copy full SHA for 5025113
compiler/parser/src/lexer.rs
@@ -1125,7 +1125,11 @@ where
1125
1126
fn eat_single_char(&mut self, ty: Tok) {
1127
let tok_start = self.get_pos();
1128
- self.next_char();
+ self.next_char().unwrap_or_else(|| unsafe {
1129
+ // SAFETY: eat_single_char has been called only after a character has been read
1130
+ // from the window, so the window is guaranteed to be non-empty.
1131
+ std::hint::unreachable_unchecked()
1132
+ });
1133
let tok_end = self.get_pos();
1134
self.emit((tok_start, ty, tok_end));
1135
}
0 commit comments