Skip to content

Improve suggestions for malformed deprecated attribute#157088

Open
ariagivens wants to merge 2 commits into
rust-lang:mainfrom
ariagivens:deprecated-attr-forms
Open

Improve suggestions for malformed deprecated attribute#157088
ariagivens wants to merge 2 commits into
rust-lang:mainfrom
ariagivens:deprecated-attr-forms

Conversation

@ariagivens
Copy link
Copy Markdown
Contributor

When the deprecated attribute is supplied a single string as an argument, suggest using the NameValueStr syntax.

error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:24:5
   |
LL |     #[deprecated("test")]
   |     ^^^^^^^^^^^^^------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try using `=` instead
   |
LL -     #[deprecated("test")]
LL +     #[deprecated = "test"]
   |

If the string looked like a version (e.g. "1.2.3" or "TBD"), suggest using the since field instead.

error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:27:5
   |
LL |     #[deprecated("1.2.3")]
   |     ^^^^^^^^^^^^^-------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try specifying a deprecated since version
   |
LL |     #[deprecated(since = "1.2.3")]
   |                  +++++++

@rustbot
Copy link
Copy Markdown
Collaborator

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

rustbot commented May 29, 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 19 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.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 29, 2026

📌 Commit 9bfbf34 has been approved by JonathanBrouwer

It is now in the queue for this repository.

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

@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 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 29, 2026
…r=JonathanBrouwer

Improve suggestions for malformed deprecated attribute

When the deprecated attribute is supplied a single string as an argument, suggest using the NameValueStr syntax.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:24:5
   |
LL |     #[deprecated("test")]
   |     ^^^^^^^^^^^^^------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try using `=` instead
   |
LL -     #[deprecated("test")]
LL +     #[deprecated = "test"]
   |
```
If the string looked like a version (e.g. `"1.2.3"` or `"TBD"`), suggest using the since field instead.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:27:5
   |
LL |     #[deprecated("1.2.3")]
   |     ^^^^^^^^^^^^^-------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try specifying a deprecated since version
   |
LL |     #[deprecated(since = "1.2.3")]
   |                  +++++++
```
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157100 (Some more per owner things)
 - #157065 (Stabilize `Path::is_empty`)
 - #157070 (Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157103 (Add reproducibly failing tests for parallel frontend)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 29, 2026
…r=JonathanBrouwer

Improve suggestions for malformed deprecated attribute

When the deprecated attribute is supplied a single string as an argument, suggest using the NameValueStr syntax.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:24:5
   |
LL |     #[deprecated("test")]
   |     ^^^^^^^^^^^^^------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try using `=` instead
   |
LL -     #[deprecated("test")]
LL +     #[deprecated = "test"]
   |
```
If the string looked like a version (e.g. `"1.2.3"` or `"TBD"`), suggest using the since field instead.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:27:5
   |
LL |     #[deprecated("1.2.3")]
   |     ^^^^^^^^^^^^^-------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try specifying a deprecated since version
   |
LL |     #[deprecated(since = "1.2.3")]
   |                  +++++++
```
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157070 (Remove `skip_arg` attribute from `Diagnostic` and `Subdiagnostic` proc-macros)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157103 (Add reproducibly failing tests for parallel frontend)

Failed merges:

 - #157100 (Some more per owner things)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 29, 2026
…r=JonathanBrouwer

Improve suggestions for malformed deprecated attribute

When the deprecated attribute is supplied a single string as an argument, suggest using the NameValueStr syntax.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:24:5
   |
LL |     #[deprecated("test")]
   |     ^^^^^^^^^^^^^------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try using `=` instead
   |
LL -     #[deprecated("test")]
LL +     #[deprecated = "test"]
   |
```
If the string looked like a version (e.g. `"1.2.3"` or `"TBD"`), suggest using the since field instead.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:27:5
   |
LL |     #[deprecated("1.2.3")]
   |     ^^^^^^^^^^^^^-------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try specifying a deprecated since version
   |
LL |     #[deprecated(since = "1.2.3")]
   |                  +++++++
```
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157103 (Add reproducibly failing tests for parallel frontend)

Failed merges:

 - #157100 (Some more per owner things)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 29, 2026
…r=JonathanBrouwer

Improve suggestions for malformed deprecated attribute

When the deprecated attribute is supplied a single string as an argument, suggest using the NameValueStr syntax.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:24:5
   |
LL |     #[deprecated("test")]
   |     ^^^^^^^^^^^^^------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try using `=` instead
   |
LL -     #[deprecated("test")]
LL +     #[deprecated = "test"]
   |
```
If the string looked like a version (e.g. `"1.2.3"` or `"TBD"`), suggest using the since field instead.
```
error[E0565]: malformed `deprecated` attribute input
  --> $DIR/deprecation-sanity.rs:27:5
   |
LL |     #[deprecated("1.2.3")]
   |     ^^^^^^^^^^^^^-------^^
   |                  |
   |                  didn't expect a literal here
   |
help: try specifying a deprecated since version
   |
LL |     #[deprecated(since = "1.2.3")]
   |                  +++++++
```
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157098 (Add the `clflushopt` x86 target feature)
 - #157103 (Add reproducibly failing tests for parallel frontend)
 - #157111 (Update target maintainer for x86_64-unknown-linux-none)
 - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
 - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
 - #157120 (Cleanups around attribute target checking)

Failed merges:

 - #157100 (Some more per owner things)
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157098 (Add the `clflushopt` x86 target feature)
 - #157103 (Add reproducibly failing tests for parallel frontend)
 - #157111 (Update target maintainer for x86_64-unknown-linux-none)
 - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
 - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
 - #157120 (Cleanups around attribute target checking)

Failed merges:

 - #157100 (Some more per owner things)
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157098 (Add the `clflushopt` x86 target feature)
 - #157103 (Add reproducibly failing tests for parallel frontend)
 - #157111 (Update target maintainer for x86_64-unknown-linux-none)
 - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
 - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
 - #157120 (Cleanups around attribute target checking)

Failed merges:

 - #157100 (Some more per owner things)
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157098 (Add the `clflushopt` x86 target feature)
 - #157103 (Add reproducibly failing tests for parallel frontend)
 - #157111 (Update target maintainer for x86_64-unknown-linux-none)
 - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
 - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
 - #157120 (Cleanups around attribute target checking)

Failed merges:

 - #157100 (Some more per owner things)
rust-bors Bot pushed a commit that referenced this pull request May 29, 2026
…uwer

Rollup of 16 pull requests



Successful merges:

 - #149195 (resolve: Partially convert `ambiguous_glob_imports` lint into a hard error)
 - #156960 (Some cleanups around passing extra lifetime params from the resolver to ast lowering)
 - #156963 (definitions: remove `DefPathTable`, use `LocalDefId` instead of `DefIndex`)
 - #157053 (Eagerly resolve delegations in late resolution)
 - #157068 (NVPTX: Remove the unstable ptx linker flavor)
 - #157076 (Various proc-macro related code cleanups)
 - #157106 (add ABI check logic for wasm)
 - #154835 (std::offload sharedmem)
 - #157065 (Stabilize `Path::is_empty`)
 - #157088 (Improve suggestions for malformed deprecated attribute)
 - #157098 (Add the `clflushopt` x86 target feature)
 - #157103 (Add reproducibly failing tests for parallel frontend)
 - #157111 (Update target maintainer for x86_64-unknown-linux-none)
 - #157116 (rustc_public: add `with_cx()` to `CompilerInterface`)
 - #157119 (ast_lowering: Simplify `resolve_pin_drop_sugar_impl_item`)
 - #157120 (Cleanups around attribute target checking)

Failed merges:

 - #157100 (Some more per owner things)
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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