about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/mod.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-07-17 17:59:05 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-07-19 15:25:55 +1000
commitca6649516f24fcfabeeee07e287d4de8958e83fe (patch)
treef55dde27c1e973c93191615a996764c8dcfc8d70 /compiler/rustc_parse/src/parser/mod.rs
parentf9c7ca70cb3a10e0113113d054b9214b98455ae5 (diff)
downloadrust-ca6649516f24fcfabeeee07e287d4de8958e83fe.tar.gz
rust-ca6649516f24fcfabeeee07e287d4de8958e83fe.zip
Make `Parser::num_bump_calls` 0-indexed.
Currently in `collect_tokens_trailing_token`, `start_pos` and `end_pos`
are 1-indexed by `replace_ranges` is 0-indexed, which is really
confusing. Making them both 0-indexed makes debugging much easier.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index 9a63a205242..33900503520 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -425,6 +425,11 @@ impl<'a> Parser<'a> {
         // Make parser point to the first token.
         parser.bump();
 
+        // Change this from 1 back to 0 after the bump. This eases debugging of
+        // `Parser::collect_tokens_trailing_token` nicer because it makes the
+        // token positions 0-indexed which is nicer than 1-indexed.
+        parser.num_bump_calls = 0;
+
         parser
     }