diff options
| -rw-r--r-- | compiler/rustc_attr_parsing/src/session_diagnostics.rs | 5 | ||||
| -rw-r--r-- | tests/ui/attributes/malformed-attrs.stderr | 20 | ||||
| -rw-r--r-- | tests/ui/extern/issue-47725.rs | 1 | ||||
| -rw-r--r-- | tests/ui/extern/issue-47725.stderr | 5 |
4 files changed, 6 insertions, 25 deletions
diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index a815aa8c7a8..6145f1e1d3e 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -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( diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index de639aa958c..a6baf2e02d6 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -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 diff --git a/tests/ui/extern/issue-47725.rs b/tests/ui/extern/issue-47725.rs index 012673b9159..60d0cd62347 100644 --- a/tests/ui/extern/issue-47725.rs +++ b/tests/ui/extern/issue-47725.rs @@ -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; } diff --git a/tests/ui/extern/issue-47725.stderr b/tests/ui/extern/issue-47725.stderr index 53d6b4927f8..4fd02a1778b 100644 --- a/tests/ui/extern/issue-47725.stderr +++ b/tests/ui/extern/issue-47725.stderr @@ -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 |
