about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-02-05 22:51:23 +0100
committervarkor <github@varkor.com>2019-02-11 11:17:35 +0000
commit2a8a25be37f87dd21dfeeb3dd092d6530dbb5396 (patch)
tree85b46116803fdb881360fd72d8656d199263b82c /src
parent87cd09b94c00a07f2bd19366c71ac0c12579ee0e (diff)
downloadrust-2a8a25be37f87dd21dfeeb3dd092d6530dbb5396.tar.gz
rust-2a8a25be37f87dd21dfeeb3dd092d6530dbb5396.zip
Display "Deprecation planned" in rustdoc for future rustc deprecations
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render.rs31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3de74491a33..00ee24e59c2 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2817,7 +2817,17 @@ fn stability_tags(item: &clean::Item) -> String {
 
     // The trailing space after each tag is to space it properly against the rest of the docs.
     if item.deprecation().is_some() {
-        tags += &tag_html("deprecated", "Deprecated");
+        let mut message = "Deprecated";
+        if let Some(ref stab) = item.stability {
+            if let Some(ref depr) = stab.deprecation {
+                if let Some(ref since) = depr.since {
+                    if !stability::deprecation_in_effect(&since) {
+                        message = "Deprecation planned";
+                    }
+                }
+            }
+        }
+        tags += &tag_html("deprecated", message);
     }
 
     if let Some(stab) = item
@@ -2848,15 +2858,18 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
     if let Some(Deprecation { note, .. }) = &item.deprecation() {
         // We display deprecation messages for #[deprecated] and #[rustc_deprecated]
         // but only display the future-deprecation messages for #[rustc_deprecated].
-        let mut message = if let Some(since) = item.stability.deprecation.since {
-            if stability::deprecation_in_effect(since) {
-                format!("Deprecated since {}", Escape(since))
-            } else {
-                format!("Deprecating in {}", Escape(since))
+        let mut message = String::from("Deprecated");
+        if let Some(ref stab) = item.stability {
+            if let Some(ref depr) = stab.deprecation {
+                if let Some(ref since) = depr.since {
+                    if stability::deprecation_in_effect(&since) {
+                        message = format!("Deprecated since {}", Escape(&since));
+                    } else {
+                        message = format!("Deprecating in {}", Escape(&since));
+                    }
+                }
             }
-        } else {
-            String::from("Deprecated")
-        };
+        }
 
         if let Some(note) = note {
             let mut ids = cx.id_map.borrow_mut();