diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-08-12 09:28:35 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-08-14 15:31:29 +1000 |
| commit | 145b84721aae8e62d90b0fe40e8f796289ff7303 (patch) | |
| tree | a52327d35782b43f7d9e8e12616e647a995e9d48 /compiler/rustc_ast/src/tokenstream.rs | |
| parent | 2fd855fbfc8239285aa2d596f76a8cc75e17ce02 (diff) | |
| download | rust-145b84721aae8e62d90b0fe40e8f796289ff7303.tar.gz rust-145b84721aae8e62d90b0fe40e8f796289ff7303.zip | |
Sometimes skip over tokens in `parse_token_tree`.
This sometimes avoids a lot of `bump` calls.
Diffstat (limited to 'compiler/rustc_ast/src/tokenstream.rs')
| -rw-r--r-- | compiler/rustc_ast/src/tokenstream.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/tokenstream.rs b/compiler/rustc_ast/src/tokenstream.rs index e55399adfb8..f4f35a4d2ee 100644 --- a/compiler/rustc_ast/src/tokenstream.rs +++ b/compiler/rustc_ast/src/tokenstream.rs @@ -907,6 +907,12 @@ impl TokenTreeCursor { pub fn bump(&mut self) { self.index += 1; } + + // For skipping ahead in rare circumstances. + #[inline] + pub fn bump_to_end(&mut self) { + self.index = self.stream.len(); + } } /// A `TokenStream` cursor that produces `Token`s. It's a bit odd that |
