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

Merged
merged 4 commits into from
Jul 2, 2025
Merged

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.

@geoffw0
Copy link
Contributor

geoffw0 commented Jul 2, 2025

I'd definitely like to see a DCA run for this change. 🤞

@redsun82 redsun82 added the no-change-note-required This PR does not need a change note label Jul 2, 2025
@redsun82
Copy link
Contributor Author

redsun82 commented Jul 2, 2025

DCA looks good!

Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

Yep. 👍

@redsun82 redsun82 merged commit c10d899 into main Jul 2, 2025
22 of 23 checks passed
@redsun82 redsun82 deleted the redsun82/fix-expansion-in-lib branch July 2, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants