Skip to content

fix: impl Trait inside macro parsed incorrectly #6640

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 2 commits into
base: master
Choose a base branch
from

Conversation

tvsfx
Copy link

@tvsfx tvsfx commented Aug 18, 2025

This PR is probably (?) too blunt an approach, but it does illustrate how one could go about fixing #6036.
Adds a test for illustration purposes.

@tvsfx
Copy link
Author

tvsfx commented Aug 19, 2025

Issue #3004 seems to be the only regression (surprisingly), but I'm not sure how my change caused this.

Mismatch at tests/source/macros.rs:1032:
 
 fn issue3004() {
     foo!(|_| { () });
-    stringify!((foo+));
+    stringify!(( foo+ ));
 }

EDIT: I misinterpreted the parse_item method's return value; I think the other parsers (for Ty and Pat) should be tried when it returns None, cause that means that the parsed argument starts with a token that's invalid for an Item. I pushed a commit that does this, and it should make tests pass.

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

Successfully merging this pull request may close these issues.

2 participants