Skip to content

fix(rust) ensure brackets are balanced within attributes #4237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ewwwin
Copy link

@ewwwin ewwwin commented Apr 7, 2025

Fixes #4032.

Changes

Rust attributes can contain nested brackets, braces, and parentheses. This PR adds sub-modes for these nested delimiter groups, ensuring that attribute matches ends only when nested square brackets and other delimiters are balanced.

Syntax reference: The Rust Reference: Attributes. (The actual set of recognized bracket types is derived from DelimTokenTree which is defined in Macros).

Checklist

  • Added markup tests
  • Updated the changelog at CHANGES.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Rust) Mismatched brackets in complex attribute
2 participants