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);
}
AttributeParseErrorReason::ExpectedNameValue(None) => {
diag.span_label(
self.span,
format!("expected this to be of the form `{name} = \"...\"`"),
);
// The suggestion we add below this match already contains enough information
}
AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
diag.span_label(

View File

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

View File

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

View File

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