about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-20 09:01:41 +0000
committerbors <bors@rust-lang.org>2025-08-20 09:01:41 +0000
commitbec747418c9955de4c3fd0aac4acb99206f00aa2 (patch)
tree68c401d44d78086821a158712dbb4b1647b7acf7 /compiler/rustc_ast
parent22a86f8280becb12c34ee3efd952baf5cf086fa0 (diff)
parent145b84721aae8e62d90b0fe40e8f796289ff7303 (diff)
downloadrust-bec747418c9955de4c3fd0aac4acb99206f00aa2.tar.gz
rust-bec747418c9955de4c3fd0aac4acb99206f00aa2.zip
Auto merge of #145348 - nnethercote:parse_token_tree-speedup-for-uom, r=petrochenkov
Sometimes skip over tokens in `parse_token_tree`.

r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/tokenstream.rs6
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