Hint that the unwrap should always succeed.

This commit is contained in:
Dimitris Fasarakis Hilliard 2023-02-01 12:17:33 +02:00
parent c9364718b4
commit 1468fe46ab

View file

@ -1125,7 +1125,11 @@ where
fn eat_single_char(&mut self, ty: Tok) {
let tok_start = self.get_pos();
self.next_char();
self.next_char().unwrap_or_else(|| unsafe {
// SAFETY: eat_single_char has been called only after a character has been read
// from the window, so the window is guaranteed to be non-empty.
std::hint::unreachable_unchecked()
});
let tok_end = self.get_pos();
self.emit((tok_start, ty, tok_end));
}