-
Notifications
You must be signed in to change notification settings - Fork 14k
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
base: main
Are you sure you want to change the base?
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.
```
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
```
811d2e7 to
9ca8198
Compare
|
This PR was rebased onto a different master 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. |
|
@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.
Fix #146325.