Skip to content

Double help message for new attribute parsing #143136

Closed
@JonathanBrouwer

Description

@JonathanBrouwer

Code

#[unsafe(export_name)]
fn test() { }

Current output

error[E0539]: malformed `export_name` attribute input
 --> src/main.rs:7:1
  |
7 | #[unsafe(export_name)]
  | ^^^^^^^^^^^^^^^^^^^^^^
  | |
  | expected this to be of the form `export_name = "..."`
  | help: must be of the form: `#[export_name = "name"]`

Desired output

error[E0539]: malformed `export_name` attribute input
 --> src/main.rs:7:1
  |
7 | #[unsafe(export_name)]
  | ^^^^^^^^^^^^^^^^^^^^^^
  | |
  | help: must be of the form: `#[export_name = "name"]`

Rationale and extra context

The "expected this to be of form" and "must be of the form" are just saying the same thing twice
@rustbot claim
cc @jdonszelmann

Other cases

Rust Version

cargo 1.89.0-nightly (2251525ae 2025-06-16)
release: 1.89.0-nightly
commit-hash: 2251525ae503fa196f6d7f9ce6d32eccb2d5f044
commit-date: 2025-06-16
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.2 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Arch Linux Rolling Release [64-bit]

Anything else?

No response

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions