about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2022-03-04 21:59:18 -0500
committerJacob Pratt <jacob@jhpratt.dev>2022-03-09 16:32:47 -0500
commit38478ea0cda8c7e2a4e8e841f97910bcb6d08ef3 (patch)
treee47063526a6844f7be37f6986be543636b4c2c54 /compiler
parent5636655d0f0afb0d509cd86ad479773f5854630e (diff)
Permit `#[deprecated]` in stdlib
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs8
-rw-r--r--compiler/rustc_attr/src/builtin.rs9
-rw-r--r--compiler/rustc_passes/src/stability.rs2
3 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs
index beec7c2b6df..097bd07c74c 100644
--- a/compiler/rustc_ast_passes/src/feature_gate.rs
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs
@@ -437,14 +437,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
                 )
                 .emit();
             }
-        } else {
-            // FIXME(jhpratt) remove this after the two attributes are merged
-            if attr.has_name(sym::deprecated) {
-                self.sess
-                    .struct_span_err(attr.span, "`#[deprecated]` cannot be used in staged API")
-                    .span_label(attr.span, "use `#[rustc_deprecated]` instead")
-                    .emit();
-            }
         }
     }
 
diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs
index 9a750d9f40f..dd5642c212e 100644
--- a/compiler/rustc_attr/src/builtin.rs
+++ b/compiler/rustc_attr/src/builtin.rs
@@ -665,6 +665,7 @@ where
 {
     let mut depr: Option<(Deprecation, Span)> = None;
     let diagnostic = &sess.parse_sess.span_diagnostic;
+    let is_rustc = sess.features_untracked().staged_api;
 
     'outer: for attr in attrs_iter {
         if !(attr.has_name(sym::deprecated) || attr.has_name(sym::rustc_deprecated)) {
@@ -790,7 +791,7 @@ where
             }
         }
 
-        if attr.has_name(sym::rustc_deprecated) {
+        if is_rustc {
             if since.is_none() {
                 handle_errors(&sess.parse_sess, attr.span, AttrError::MissingSince);
                 continue;
@@ -802,8 +803,10 @@ where
             }
         }
 
-        let is_since_rustc_version = attr.has_name(sym::rustc_deprecated);
-        depr = Some((Deprecation { since, note, suggestion, is_since_rustc_version }, attr.span));
+        depr = Some((
+            Deprecation { since, note, suggestion, is_since_rustc_version: is_rustc },
+            attr.span,
+        ));
     }
 
     depr
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index 37a9f0ecd8c..f36a1f61aac 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -202,7 +202,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
                     self.tcx.sess,
                     *span,
                     E0549,
-                    "rustc_deprecated attribute must be paired with \
+                    "deprecated attribute must be paired with \
                     either stable or unstable attribute"
                 )
                 .emit();