Skip to content

Suggest adding quotation marks to identifiers in attributes#156797

Open
ariagivens wants to merge 1 commit into
rust-lang:mainfrom
ariagivens:suggest-quotes
Open

Suggest adding quotation marks to identifiers in attributes#156797
ariagivens wants to merge 1 commit into
rust-lang:mainfrom
ariagivens:suggest-quotes

Conversation

@ariagivens
Copy link
Copy Markdown
Contributor

When the user provides an identifier when a literal was expected in an attribute value, suggest adding quotation marks to the identifier to make it a string literal.

For instance:

error: attribute value must be a literal
  --> $DIR/crate-type-non-crate.rs:9:16
   |
LL | #[crate_type = lib]
   |                ^^^ help: try adding quotation marks: `"lib"`

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 21, 2026

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@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 May 21, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 21, 2026

r? @Kivooeo

rustbot has assigned @Kivooeo.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer left a comment

Choose a reason for hiding this comment

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

Thanks for the work ❤️
@bors r+ rollup

View changes since this review

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Bors u there???
@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 21, 2026

📌 Commit 8fec623 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 May 21, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 21, 2026
…hanBrouwer

Suggest adding quotation marks to identifiers in attributes

When the user provides an identifier when a literal was expected in an attribute value, suggest adding quotation marks to the identifier to make it a string literal.

For instance:
```
error: attribute value must be a literal
  --> $DIR/crate-type-non-crate.rs:9:16
   |
LL | #[crate_type = lib]
   |                ^^^ help: try adding quotation marks: `"lib"`
```
rust-bors Bot pushed a commit that referenced this pull request May 21, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #152112 (Use strongly typed wrapped indices in `VecDeque`)
 - #156797 (Suggest adding quotation marks to identifiers in attributes)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 21, 2026
…hanBrouwer

Suggest adding quotation marks to identifiers in attributes

When the user provides an identifier when a literal was expected in an attribute value, suggest adding quotation marks to the identifier to make it a string literal.

For instance:
```
error: attribute value must be a literal
  --> $DIR/crate-type-non-crate.rs:9:16
   |
LL | #[crate_type = lib]
   |                ^^^ help: try adding quotation marks: `"lib"`
```
rust-bors Bot pushed a commit that referenced this pull request May 21, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #155307 (Stabilize `--remap-path-prefix` in rustdoc)
 - #152112 (Use strongly typed wrapped indices in `VecDeque`)
 - #156797 (Suggest adding quotation marks to identifiers in attributes)
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

@bors r-
#156808 (comment)

@rust-bors rust-bors Bot 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 May 22, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 22, 2026

This pull request was unapproved.

This PR was contained in a rollup (#156808), which was unapproved.

View changes since this unapproval

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.

4 participants