about summary refs log tree commit diff
path: root/src/librustdoc/html/render.rs
diff options
context:
space:
mode:
authorMartin Wernstål <m4rw3r@gmail.com>2015-08-16 17:20:37 +0200
committerMartin Wernstål <m4rw3r@gmail.com>2015-08-16 22:15:26 +0200
commit9698e8fd17a3517bc5904ceb74e0bdbf7e332413 (patch)
treeb7a5b20dcc19c6bbbf86d991db9568168a07dbcf /src/librustdoc/html/render.rs
parentb31038764dbc060b8fcccdee89e5e43072428458 (diff)
downloadrust-9698e8fd17a3517bc5904ceb74e0bdbf7e332413.tar.gz
rust-9698e8fd17a3517bc5904ceb74e0bdbf7e332413.zip
rustdoc: Print feature flag and issue link if present in short_stability
Diffstat (limited to 'src/librustdoc/html/render.rs')
-rw-r--r--src/librustdoc/html/render.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index dceb052e796..c36fb95be42 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1709,7 +1709,22 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio
             };
             format!("Deprecated{}{}", since, Markdown(&reason))
         } else if stab.level == attr::Unstable {
-            format!("Unstable{}", Markdown(&reason))
+            let unstable_extra = if show_reason {
+                match (!stab.feature.is_empty(), &cx.issue_tracker_base_url, stab.issue) {
+                    (true, &Some(ref tracker_url), Some(issue_no)) =>
+                        format!(" (<code>{}</code> <a href=\"{}{}\">#{}</a>)", Escape(&stab.feature),
+                                tracker_url, issue_no, issue_no),
+                    (false, &Some(ref tracker_url), Some(issue_no)) =>
+                        format!(" (<a href=\"{}{}\">#{}</a>)", Escape(&tracker_url), issue_no,
+                                issue_no),
+                    (true, _, _) =>
+                        format!(" (<code>{}</code>)", Escape(&stab.feature)),
+                    _ => String::new(),
+                }
+            } else {
+                String::new()
+            };
+            format!("Unstable{}{}", unstable_extra, Markdown(&reason))
         } else {
             return None
         };