about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-28 22:15:27 +0000
committerbors <bors@rust-lang.org>2022-12-28 22:15:27 +0000
commit9709a438721d679572f0f7c389cd1fa60922fbef (patch)
treeca63a7f825245e371065234fc7764f5d4658a72f /compiler/rustc_parse/src/parser
parent270c94e484e19764a2832ef918c95224eb3f17c7 (diff)
parent89ccd704f04f86e70a58e8ae6867656503e4b89c (diff)
downloadrust-9709a438721d679572f0f7c389cd1fa60922fbef.tar.gz
rust-9709a438721d679572f0f7c389cd1fa60922fbef.zip
Auto merge of #106228 - matthiaskrgr:rollup-jsznhww, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104402 (Move `ReentrantMutex` to `std::sync`)
 - #104493 (available_parallelism: Gracefully handle zero value cfs_period_us)
 - #105359 (Make sentinel value configurable in `library/std/src/sys_common/thread_local_key.rs`)
 - #105497 (Clarify `catch_unwind` docs about panic hooks)
 - #105570 (Properly calculate best failure in macro matching)
 - #105702 (Format only modified files)
 - #105998 (adjust message on non-unwinding panic)
 - #106161 (Iterator::find: link to Iterator::position in docs for discoverability)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 40b88788caa..919e71bd115 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -1499,6 +1499,10 @@ impl<'a> Parser<'a> {
     pub fn clear_expected_tokens(&mut self) {
         self.expected_tokens.clear();
     }
+
+    pub fn approx_token_stream_pos(&self) -> usize {
+        self.token_cursor.num_next_calls
+    }
 }
 
 pub(crate) fn make_unclosed_delims_error(