about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_attr/src/builtin.rs3
-rw-r--r--compiler/rustc_passes/src/stability.rs6
-rw-r--r--src/test/ui/deprecation/deprecation-sanity.rs2
-rw-r--r--src/test/ui/deprecation/deprecation-sanity.stderr12
-rw-r--r--src/test/ui/stability-attribute/stability-attribute-sanity.stderr8
5 files changed, 12 insertions, 19 deletions
diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs
index 49ac97d833f..2fd625c2a6c 100644
--- a/compiler/rustc_attr/src/builtin.rs
+++ b/compiler/rustc_attr/src/builtin.rs
@@ -656,7 +656,8 @@ where
 
         if let Some((_, span)) = &depr {
             struct_span_err!(diagnostic, attr.span, E0550, "multiple deprecated attributes")
-                .span_note(*span, "first deprecation attribute here")
+                .span_label(attr.span, "repeated deprecation attribute")
+                .span_label(*span, "first deprecation attribute")
                 .emit();
             break;
         }
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index f6923b0dd9c..04b5c65e464 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -92,10 +92,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
 
             if kind == AnnotationKind::Prohibited || kind == AnnotationKind::DeprecationProhibited {
                 self.tcx.struct_span_lint_hir(USELESS_DEPRECATED, hir_id, *span, |lint| {
-                    lint.build("this `#[deprecated]' annotation has no effect")
-                        .span_suggestion(
+                    lint.build("this `#[deprecated]` annotation has no effect")
+                        .span_suggestion_short(
                             *span,
-                            "try removing the deprecation attribute",
+                            "remove the unnecessary deprecation attribute",
                             String::new(),
                             rustc_errors::Applicability::MachineApplicable,
                         )
diff --git a/src/test/ui/deprecation/deprecation-sanity.rs b/src/test/ui/deprecation/deprecation-sanity.rs
index 5fb3f819589..4fc3fddadb9 100644
--- a/src/test/ui/deprecation/deprecation-sanity.rs
+++ b/src/test/ui/deprecation/deprecation-sanity.rs
@@ -32,7 +32,7 @@ fn f1() { }
 
 struct X;
 
-#[deprecated = "hello"] //~ ERROR this `#[deprecated]' annotation has no effect
+#[deprecated = "hello"] //~ ERROR this `#[deprecated]` annotation has no effect
 impl Default for X {
     fn default() -> Self {
         X
diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr
index b926a6dc09d..7e70c35eeab 100644
--- a/src/test/ui/deprecation/deprecation-sanity.stderr
+++ b/src/test/ui/deprecation/deprecation-sanity.stderr
@@ -44,13 +44,9 @@ error[E0550]: multiple deprecated attributes
   --> $DIR/deprecation-sanity.rs:27:1
    |
 LL | #[deprecated(since = "a", note = "b")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: first deprecation attribute here
-  --> $DIR/deprecation-sanity.rs:26:1
-   |
+   | -------------------------------------- first deprecation attribute
 LL | #[deprecated(since = "a", note = "b")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute
 
 error[E0538]: multiple 'since' items
   --> $DIR/deprecation-sanity.rs:30:27
@@ -58,11 +54,11 @@ error[E0538]: multiple 'since' items
 LL | #[deprecated(since = "a", since = "b", note = "c")]
    |                           ^^^^^^^^^^^
 
-error: this `#[deprecated]' annotation has no effect
+error: this `#[deprecated]` annotation has no effect
   --> $DIR/deprecation-sanity.rs:35:1
    |
 LL | #[deprecated = "hello"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove the unnecessary deprecation attribute
    |
    = note: `#[deny(useless_deprecated)]` on by default
 
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
index f3edd5773cb..bf2436a535f 100644
--- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
@@ -86,13 +86,9 @@ error[E0550]: multiple deprecated attributes
   --> $DIR/stability-attribute-sanity.rs:62:1
    |
 LL | #[rustc_deprecated(since = "b", reason = "text")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: first deprecation attribute here
-  --> $DIR/stability-attribute-sanity.rs:61:1
-   |
+   | ------------------------------------------------- first deprecation attribute
 LL | #[rustc_deprecated(since = "b", reason = "text")]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ repeated deprecation attribute
 
 error[E0544]: multiple stability levels
   --> $DIR/stability-attribute-sanity.rs:64:1