diff options
Diffstat (limited to 'compiler/rustc_lexer/src/cursor.rs')
| -rw-r--r-- | compiler/rustc_lexer/src/cursor.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_lexer/src/cursor.rs b/compiler/rustc_lexer/src/cursor.rs index d173c3ac032..e0e3bd0e30b 100644 --- a/compiler/rustc_lexer/src/cursor.rs +++ b/compiler/rustc_lexer/src/cursor.rs @@ -103,4 +103,11 @@ impl<'a> Cursor<'a> { self.bump(); } } + + pub(crate) fn eat_until(&mut self, byte: u8) { + self.chars = match memchr::memchr(byte, self.as_str().as_bytes()) { + Some(index) => self.as_str()[index..].chars(), + None => "".chars(), + } + } } |
