Skip to content

Commit 1587828

Browse files
committed
rollback eat_until changes
1 parent 8103c8f commit 1587828

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

compiler/rustc_lexer/src/cursor.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,11 @@ impl<'a> Cursor<'a> {
153153
}
154154
/// Eats characters until the given byte is found.
155155
/// Returns true if the byte was found, false if end of file was reached.
156-
pub(crate) fn eat_until(&mut self, byte: u8) -> bool {
157-
match memchr::memchr(byte, self.as_str().as_bytes()) {
158-
Some(index) => {
159-
self.bump_bytes(index);
160-
true
161-
}
162-
None => {
163-
self.chars = "".chars();
164-
false
165-
}
166-
}
156+
pub(crate) fn eat_until(&mut self, byte: u8) {
157+
self.chars = match memchr::memchr(byte, self.as_str().as_bytes()) {
158+
Some(index) => self.as_str()[index..].chars(),
159+
None => "".chars(),
160+
};
167161
}
168162

169163
/// Eats characters until any of the given bytes is found, then consumes past it.

compiler/rustc_lexer/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,9 @@ impl Cursor<'_> {
10311031
// Skip the string contents and on each '#' character met, check if this is
10321032
// a raw string termination.
10331033
loop {
1034-
if !self.eat_until(b'"') {
1034+
self.eat_until(b'"');
1035+
1036+
if self.is_eof() {
10351037
return Err(RawStrError::NoTerminator {
10361038
expected: n_start_hashes,
10371039
found: max_hashes,

0 commit comments

Comments
 (0)