Files
rust/compiler/rustc_parse
Jonathan Brouwer 4410eba1c2 Rollup merge of #161637 - nnethercote:clarify-token-cursor, r=Kobzol
Clarify token cursor behaviour

The meaning of `TokenTreeCursor::index` is context-dependent: in the innermost (current) `TokenTreeCursor` it points to the next token tree, but in all the other (stack) `TokenTreeCursor`s it points to the current token tree. This makes the meanings of "current", "next", and "look_ahead" confusing for it and for `TokenCursor`.

This commit clarifies things by adjusting the stack `TokenTreeCursor`s to also point to the next token tree, and by improving various comments.

The commit also renames `TokenCursor::next` as
`TokenCursor::next_and_bump` for consistency with everything else: `next` means "get the next thing" and `bump` means "advance the cursor", and this operation does both.

r? @Kobzol
2026-08-24 15:06:59 +02:00
..