Skip to content

Rust: fix macro expansion in library code #19945

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 1 commit into
base: main
Choose a base branch
from

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Jul 1, 2025

There was a mismatch between a self.macro_context_level += 1 and the corresponding self.macro_context_level -= 1, which resulted in an usize underflow (panic in debug mode, wrong behaviour in release mode).

This fixes it and adds a relevant assertion and test. In order to properly test library mode extraction, a special option enforcing that on source code as well is added.

There was a mismatch between a `self.macro_context_level += 1` and the
corresponding `self.macro_context_level -= 1`, which resulted in an
`usize` underflow (panic in debug mode, wrong behaviour in release
mode).

This fixes it and adds a relevant assertion and test. In order to
properly test library mode extraction, a special option enforcing that
on source code as well is added.
@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 15:32
@redsun82 redsun82 requested a review from a team as a code owner July 1, 2025 15:32
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Jul 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant