-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Handle macro invocation in attribute during parse #146579
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
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
r? @davidtwco rustbot has assigned @davidtwco. Use |
| let before = self.parser.token.span.shrink_to_lo(); | ||
| while let token::Ident(..) = self.parser.token.kind { | ||
| self.parser.bump(); | ||
| if self.parser.look_ahead(1, |t| matches!(t.kind, token::TokenKind::Bang)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we meet:
#[deprecated(note = a!=b)]
struct X;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly me, I organized things thinking of only parsing a macro and not a statement. I think that parse_stmt_without_recovery will fail because of a lack of ;, but I can look at the stmt.kind instead. It should give the error with no note or structured suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll wait with further review for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looking good though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
|
r? jdonszelmann |
|
r? author |
This comment was marked as resolved.
This comment was marked as resolved.
f48a21e to
811d2e7
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
This comment was marked as outdated.
This comment was marked as outdated.
811d2e7 to
9ca8198
Compare
This comment has been minimized.
This comment has been minimized.
|
@rustbot ready |
|
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
Handle macro invocation in attribute during parse
```
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro `concat`
--> $DIR/macro-in-attribute.rs:4:21
|
LL | #[deprecated(note = concat!("a", "b"))]
| ^^^^^^^^^^^^^^^^^ macros are not allowed here
```
Fix rust-lang#146325.
Handle macro invocation in attribute during parse
```
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro `concat`
--> $DIR/macro-in-attribute.rs:4:21
|
LL | #[deprecated(note = concat!("a", "b"))]
| ^^^^^^^^^^^^^^^^^ macros are not allowed here
```
Fix rust-lang#146325.
|
The conflicting PR merged, @estebank could you rebase? |
```
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro `concat`
--> $DIR/macro-in-attribute.rs:4:21
|
LL | #[deprecated(note = concat!("a", "b"))]
| ^^^^^^^^^^^^^^^^^ macros are not allowed here
```
9ca8198 to
761cb57
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=jdonszelmann rollup |
Rollup of 5 pull requests Successful merges: - #144938 (Enable `outline-atomics` by default on more AArch64 platforms) - #146579 (Handle macro invocation in attribute during parse) - #149400 (unstable proc_macro tracked::* rename/restructure) - #149664 (attempt to fix unreachable code regression ) - #149806 (Mirror `ubuntu:24.04` on ghcr) Failed merges: - #149789 (Cleanup in the attribute parsers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 5 pull requests Successful merges: - #144938 (Enable `outline-atomics` by default on more AArch64 platforms) - #146579 (Handle macro invocation in attribute during parse) - #149400 (unstable proc_macro tracked::* rename/restructure) - #149664 (attempt to fix unreachable code regression ) - #149806 (Mirror `ubuntu:24.04` on ghcr) Failed merges: - #149789 (Cleanup in the attribute parsers) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146579 - estebank:issue-146325, r=jdonszelmann Handle macro invocation in attribute during parse ``` error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found macro `concat` --> $DIR/macro-in-attribute.rs:4:21 | LL | #[deprecated(note = concat!("a", "b"))] | ^^^^^^^^^^^^^^^^^ macros are not allowed here ``` Fix #146325.
Fix #146325.