Skip to content

remove unnecessary variables and delimiter check#154235

Open
bb1yd wants to merge 2 commits intorust-lang:mainfrom
bb1yd:simplify-delim-check
Open

remove unnecessary variables and delimiter check#154235
bb1yd wants to merge 2 commits intorust-lang:mainfrom
bb1yd:simplify-delim-check

Conversation

@bb1yd
Copy link

@bb1yd bb1yd commented Mar 23, 2026

Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/question.20about.20lex_token_tree_open_delim.20in.20rustc_parse/with/580552157

In lex_token_tree_open_delim, after calling self.lex_token_trees(/* is_delimited */ true):

  • If the delimiters are well-balanced, the value popped from the stack will always equal to open_delim and pre_span.
  • If the delimiters are not balanced, self.lex_token_trees(/* is_delimited */ true) will return an error so this branch will not be reached

Therefore open_delimiter and open_delimiter_span can be removed.

Test tests/ui/parser all passed

@rustbot
Copy link
Collaborator

rustbot commented Mar 23, 2026

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 23, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 23, 2026

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, lexer
  • compiler, lexer expanded to 69 candidates
  • Random selection from 12 candidates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants