about summary refs log tree commit diff
path: root/compiler/rustc_passes
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-11-01 12:58:47 +0100
committerMara Bos <m-ou.se@m-ou.se>2020-11-01 20:48:58 +0100
commit6f1992a7d60152cd962feb907bfdc03290d9f8a4 (patch)
tree4d1bce6fb1416637c9e03787621c36f8cf231ba1 /compiler/rustc_passes
parent706bc336515581c7559a5ccdfae0a7d93b0508fa (diff)
downloadrust-6f1992a7d60152cd962feb907bfdc03290d9f8a4.tar.gz
rust-6f1992a7d60152cd962feb907bfdc03290d9f8a4.zip
Turn 'useless #[deprecated]' error into a lint.
Diffstat (limited to 'compiler/rustc_passes')
-rw-r--r--compiler/rustc_passes/src/stability.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index bacbab1a4f4..f6923b0dd9c 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -15,7 +15,7 @@ use rustc_middle::middle::privacy::AccessLevels;
 use rustc_middle::middle::stability::{DeprecationEntry, Index};
 use rustc_middle::ty::{self, query::Providers, TyCtxt};
 use rustc_session::lint;
-use rustc_session::lint::builtin::INEFFECTIVE_UNSTABLE_TRAIT_IMPL;
+use rustc_session::lint::builtin::{INEFFECTIVE_UNSTABLE_TRAIT_IMPL, USELESS_DEPRECATED};
 use rustc_session::parse::feature_err;
 use rustc_session::Session;
 use rustc_span::symbol::{sym, Symbol};
@@ -91,16 +91,16 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
             is_deprecated = true;
 
             if kind == AnnotationKind::Prohibited || kind == AnnotationKind::DeprecationProhibited {
-                self.tcx
-                    .sess
-                    .struct_span_err(*span, "this deprecation annotation is useless")
-                    .span_suggestion(
-                        *span,
-                        "try removing the deprecation attribute",
-                        String::new(),
-                        rustc_errors::Applicability::MachineApplicable,
-                    )
-                    .emit();
+                self.tcx.struct_span_lint_hir(USELESS_DEPRECATED, hir_id, *span, |lint| {
+                    lint.build("this `#[deprecated]' annotation has no effect")
+                        .span_suggestion(
+                            *span,
+                            "try removing the deprecation attribute",
+                            String::new(),
+                            rustc_errors::Applicability::MachineApplicable,
+                        )
+                        .emit()
+                });
             }
 
             // `Deprecation` is just two pointers, no need to intern it