Skip to content
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

fix: parse macro_rules as macro name #16314

Merged
merged 2 commits into from Jan 17, 2024

Conversation

Urhengulas
Copy link
Contributor

@Urhengulas Urhengulas commented Jan 8, 2024

This PR makes RA parse macro_rules! {} (note the missing identifier) as a MACRO_CALL instead of MACRO_RULES.

Fixes #15969.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 8, 2024
crates/parser/src/grammar/items.rs Outdated Show resolved Hide resolved
crates/parser/src/grammar/items.rs Outdated Show resolved Hide resolved
Comment on lines 436 to 440
match macro_call_after_excl(p) {
BlockLike::Block => p.eat(SEMICOLON),
BlockLike::NotBlock => p.expect(SEMICOLON),
};
m.complete(p, MACRO_CALL);
Copy link
Member

Choose a reason for hiding this comment

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

Let's undo this change here again, this is semantically different from the previous behavior. foo!{}; is not a valid item parse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But wait. Was your coment about not doing the eat or about not having it as macro_call(p: &mut Parser<'_>, m: Marker) or about both? Because I very much prefer the to add the marker to the signature to be consistent with the other functions.

@Veykril Veykril added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2024
It's a call of the third token is neither IDENT or TRY
@Urhengulas
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 17, 2024
@Urhengulas
Copy link
Contributor Author

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 17, 2024
@Veykril
Copy link
Member

Veykril commented Jan 17, 2024

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Jan 17, 2024

📌 Commit 76c67dd has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 17, 2024

⌛ Testing commit 76c67dd with merge c820980...

@bors
Copy link
Collaborator

bors commented Jan 17, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing c820980 to master...

@bors bors merged commit c820980 into rust-lang:master Jan 17, 2024
10 checks passed
@Urhengulas Urhengulas deleted the macro_rule-as-macro-name branch January 17, 2024 12:36
bors added a commit that referenced this pull request Jan 18, 2024
Refactor `macro_call` to be consistent with other functions

#16314 (comment)
bors added a commit that referenced this pull request Jan 18, 2024
Refactor `macro_call` to be consistent with other functions

#16314 (comment)
@lnicola lnicola changed the title macro_rules as macro name fix: parse macro_rules as macro name Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

should not report error for macro_rules
4 participants