Fix duplicate help on export_name and others

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
Jonathan Brouwer
2025-06-29 12:40:30 +02:00
parent 0b67d14b31
commit d22ce4c5eb
4 changed files with 6 additions and 25 deletions

View File

@@ -577,10 +577,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
diag.code(E0565); diag.code(E0565);
} }
AttributeParseErrorReason::ExpectedNameValue(None) => { AttributeParseErrorReason::ExpectedNameValue(None) => {
diag.span_label( // The suggestion we add below this match already contains enough information
self.span,
format!("expected this to be of the form `{name} = \"...\"`"),
);
} }
AttributeParseErrorReason::ExpectedNameValue(Some(name)) => { AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
diag.span_label( diag.span_label(

View File

@@ -368,10 +368,7 @@ error[E0539]: malformed `export_name` attribute input
--> $DIR/malformed-attrs.rs:32:1 --> $DIR/malformed-attrs.rs:32:1
| |
LL | #[unsafe(export_name)] LL | #[unsafe(export_name)]
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
| |
| expected this to be of the form `export_name = "..."`
| help: must be of the form: `#[export_name = "name"]`
error: `rustc_allow_const_fn_unstable` expects a list of feature names error: `rustc_allow_const_fn_unstable` expects a list of feature names
--> $DIR/malformed-attrs.rs:34:1 --> $DIR/malformed-attrs.rs:34:1
@@ -418,10 +415,7 @@ error[E0539]: malformed `rustc_macro_transparency` attribute input
--> $DIR/malformed-attrs.rs:45:1 --> $DIR/malformed-attrs.rs:45:1
| |
LL | #[rustc_macro_transparency] LL | #[rustc_macro_transparency]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
| |
| expected this to be of the form `rustc_macro_transparency = "..."`
| help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
error[E0539]: malformed `repr` attribute input error[E0539]: malformed `repr` attribute input
--> $DIR/malformed-attrs.rs:47:1 --> $DIR/malformed-attrs.rs:47:1
@@ -505,10 +499,7 @@ error[E0539]: malformed `export_name` attribute input
--> $DIR/malformed-attrs.rs:68:1 --> $DIR/malformed-attrs.rs:68:1
| |
LL | #[export_name()] LL | #[export_name()]
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
| |
| expected this to be of the form `export_name = "..."`
| help: must be of the form: `#[export_name = "name"]`
error[E0805]: malformed `used` attribute input error[E0805]: malformed `used` attribute input
--> $DIR/malformed-attrs.rs:70:1 --> $DIR/malformed-attrs.rs:70:1
@@ -530,10 +521,7 @@ error[E0539]: malformed `link_name` attribute input
--> $DIR/malformed-attrs.rs:84:1 --> $DIR/malformed-attrs.rs:84:1
| |
LL | #[link_name] LL | #[link_name]
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
| |
| expected this to be of the form `link_name = "..."`
| help: must be of the form: `#[link_name = "name"]`
error[E0539]: malformed `must_use` attribute input error[E0539]: malformed `must_use` attribute input
--> $DIR/malformed-attrs.rs:117:1 --> $DIR/malformed-attrs.rs:117:1

View File

@@ -17,7 +17,6 @@ extern "C" {
#[link_name] #[link_name]
//~^ ERROR malformed `link_name` attribute input //~^ ERROR malformed `link_name` attribute input
//~| HELP must be of the form //~| HELP must be of the form
//~| NOTE expected this to be of the form `link_name = "..."
extern "C" { extern "C" {
fn bar() -> u32; fn bar() -> u32;
} }

View File

@@ -2,10 +2,7 @@ error[E0539]: malformed `link_name` attribute input
--> $DIR/issue-47725.rs:17:1 --> $DIR/issue-47725.rs:17:1
| |
LL | #[link_name] LL | #[link_name]
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
| |
| expected this to be of the form `link_name = "..."`
| help: must be of the form: `#[link_name = "name"]`
warning: attribute should be applied to a foreign function or static warning: attribute should be applied to a foreign function or static
--> $DIR/issue-47725.rs:3:1 --> $DIR/issue-47725.rs:3:1