Skip to content

Commit d50da1e

Browse files
committed
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.
1 parent 684ae1c commit d50da1e

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_parse/src/parser

1 file changed

+5
-0
lines changed

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@ impl<'a> Parser<'a> {
435435
// Make parser point to the first token.
436436
parser.bump();
437437

438+
// Change this from 1 back to 0 after the bump. This eases debugging of
439+
// `Parser::collect_tokens_trailing_token` nicer because it makes the
440+
// token positions 0-indexed which is nicer than 1-indexed.
441+
parser.num_bump_calls = 0;
442+
438443
parser
439444
}
440445

0 commit comments

Comments
 (0)