Skip to content

Commit e89fdaa

Browse files
Fix duplicate help on export_name and others
Signed-off-by: Jonathan Brouwer <[email protected]>
1 parent e0da47c commit e89fdaa

File tree

4 files changed

+6
-25
lines changed

4 files changed

+6
-25
lines changed

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError {
566566
diag.code(E0565);
567567
}
568568
AttributeParseErrorReason::ExpectedNameValue(None) => {
569-
diag.span_label(
570-
self.span,
571-
format!("expected this to be of the form `{name} = \"...\"`"),
572-
);
569+
// The suggestion we add below this match already contains enough information
573570
}
574571
AttributeParseErrorReason::ExpectedNameValue(Some(name)) => {
575572
diag.span_label(

tests/ui/attributes/malformed-attrs.stderr

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,7 @@ error[E0539]: malformed `export_name` attribute input
368368
--> $DIR/malformed-attrs.rs:32:1
369369
|
370370
LL | #[unsafe(export_name)]
371-
| ^^^^^^^^^^^^^^^^^^^^^^
372-
| |
373-
| expected this to be of the form `export_name = "..."`
374-
| help: must be of the form: `#[export_name = "name"]`
371+
| ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
375372

376373
error: `rustc_allow_const_fn_unstable` expects a list of feature names
377374
--> $DIR/malformed-attrs.rs:34:1
@@ -418,10 +415,7 @@ error[E0539]: malformed `rustc_macro_transparency` attribute input
418415
--> $DIR/malformed-attrs.rs:45:1
419416
|
420417
LL | #[rustc_macro_transparency]
421-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
422-
| |
423-
| expected this to be of the form `rustc_macro_transparency = "..."`
424-
| help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
418+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[rustc_macro_transparency = "transparent|semitransparent|opaque"]`
425419

426420
error[E0539]: malformed `repr` attribute input
427421
--> $DIR/malformed-attrs.rs:47:1
@@ -505,10 +499,7 @@ error[E0539]: malformed `export_name` attribute input
505499
--> $DIR/malformed-attrs.rs:68:1
506500
|
507501
LL | #[export_name()]
508-
| ^^^^^^^^^^^^^^^^
509-
| |
510-
| expected this to be of the form `export_name = "..."`
511-
| help: must be of the form: `#[export_name = "name"]`
502+
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
512503

513504
error[E0805]: malformed `used` attribute input
514505
--> $DIR/malformed-attrs.rs:70:1
@@ -530,10 +521,7 @@ error[E0539]: malformed `link_name` attribute input
530521
--> $DIR/malformed-attrs.rs:84:1
531522
|
532523
LL | #[link_name]
533-
| ^^^^^^^^^^^^
534-
| |
535-
| expected this to be of the form `link_name = "..."`
536-
| help: must be of the form: `#[link_name = "name"]`
524+
| ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
537525

538526
error[E0539]: malformed `must_use` attribute input
539527
--> $DIR/malformed-attrs.rs:117:1

tests/ui/extern/issue-47725.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern "C" {
1717
#[link_name]
1818
//~^ ERROR malformed `link_name` attribute input
1919
//~| HELP must be of the form
20-
//~| NOTE expected this to be of the form `link_name = "..."
2120
extern "C" {
2221
fn bar() -> u32;
2322
}

tests/ui/extern/issue-47725.stderr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ error[E0539]: malformed `link_name` attribute input
22
--> $DIR/issue-47725.rs:17:1
33
|
44
LL | #[link_name]
5-
| ^^^^^^^^^^^^
6-
| |
7-
| expected this to be of the form `link_name = "..."`
8-
| help: must be of the form: `#[link_name = "name"]`
5+
| ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
96

107
warning: attribute should be applied to a foreign function or static
118
--> $DIR/issue-47725.rs:3:1

0 commit comments

Comments
 (0)