Skip to content

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Sep 15, 2025

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.

@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

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)) {
Copy link
Contributor

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;

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

generally looking good though :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@jdonszelmann
Copy link
Contributor

r? jdonszelmann

@rustbot rustbot assigned jdonszelmann and unassigned davidtwco Sep 15, 2025
@jdonszelmann
Copy link
Contributor

r? author

@rustbot

This comment was marked as resolved.

@jdonszelmann jdonszelmann 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 Sep 16, 2025
@rustbot

This comment has been minimized.

@estebank estebank 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 Sep 28, 2025
@jdonszelmann
Copy link
Contributor

@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 Sep 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 29, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@bors

This comment was marked as outdated.

estebank and others added 3 commits November 3, 2025 19:10
```
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
```
@rustbot
Copy link
Collaborator

rustbot commented Nov 3, 2025

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.

@estebank
Copy link
Contributor Author

estebank commented Nov 3, 2025

@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 Nov 3, 2025
@jdonszelmann
Copy link
Contributor

@bors r+ rollup thanks @estebank :3

@bors
Copy link
Collaborator

bors commented Nov 10, 2025

📌 Commit 9ca8198 has been approved by jdonszelmann

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 10, 2025

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 10, 2025
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Nov 10, 2025
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.
ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Nov 10, 2025
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.
@JonathanBrouwer
Copy link
Contributor

@bors r-

Conflict with #148712
Please rebase on that after it merges

#148800 (comment)

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 10, 2025
@JonathanBrouwer
Copy link
Contributor

The conflicting PR merged, @estebank could you rebase?

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#[deprecated(note = concat!("a", "b"))] suggestion gets nowhere

7 participants