about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-02-06 13:01:28 +0100
committervarkor <github@varkor.com>2019-02-11 11:17:35 +0000
commit3dc660f1f58762ad2eff39d09f229dc36a40ca0c (patch)
treec8e99d19d8b07bc30193c07180568a6283d29bf2
parent2a8a25be37f87dd21dfeeb3dd092d6530dbb5396 (diff)
downloadrust-3dc660f1f58762ad2eff39d09f229dc36a40ca0c.tar.gz
rust-3dc660f1f58762ad2eff39d09f229dc36a40ca0c.zip
Update existing rustdoc test
-rw-r--r--src/librustdoc/html/render.rs12
-rw-r--r--src/test/rustdoc/deprecated-future.rs2
2 files changed, 8 insertions, 6 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 00ee24e59c2..b98f4118614 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2855,16 +2855,18 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
     let mut stability = vec![];
     let error_codes = ErrorCodes::from(UnstableFeatures::from_environment().is_nightly_build());
 
-    if let Some(Deprecation { note, .. }) = &item.deprecation() {
+    if let Some(Deprecation { note, since }) = &item.deprecation() {
         // We display deprecation messages for #[deprecated] and #[rustc_deprecated]
         // but only display the future-deprecation messages for #[rustc_deprecated].
-        let mut message = String::from("Deprecated");
+        let mut message = if let Some(since) = since {
+            format!("Deprecated since {}", Escape(since))
+        } else {
+            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 {
+                    if !stability::deprecation_in_effect(&since) {
                         message = format!("Deprecating in {}", Escape(&since));
                     }
                 }
diff --git a/src/test/rustdoc/deprecated-future.rs b/src/test/rustdoc/deprecated-future.rs
index 383afe86cb4..015aade4c88 100644
--- a/src/test/rustdoc/deprecated-future.rs
+++ b/src/test/rustdoc/deprecated-future.rs
@@ -1,6 +1,6 @@
 #![feature(deprecated)]
 
 // @has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \
-//      'Deprecating in 99.99.99: effectively never'
+//      'Deprecated since 99.99.99: effectively never'
 #[deprecated(since = "99.99.99", note = "effectively never")]
 pub struct S;