about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-08-05 14:38:52 +0800
committerkennytm <kennytm@gmail.com>2017-08-10 13:43:59 +0800
commita2b888675accccedec7601cc3bd67ca028b4757c (patch)
treea13d255f58f1e86112774af9e8c297871adf5834 /src/librustdoc/html
parent8f935fbb5b7e8ea5a320082cb9e28095aa0b5759 (diff)
downloadrust-a2b888675accccedec7601cc3bd67ca028b4757c.tar.gz
rust-a2b888675accccedec7601cc3bd67ca028b4757c.zip
Implemented #[doc(cfg(...))].
This attribute has two effects:

1. Items with this attribute and their children will have the "This is
   supported on **** only" message attached in the documentation.

2. The items' doc tests will be skipped if the configuration does not
   match.
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render.rs8
-rw-r--r--src/librustdoc/html/static/styles/main.css1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index fc0adef70ba..95aa8e97dbb 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1950,6 +1950,14 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec<S
         stability.push(format!("<div class='stab deprecated'>{}</div>", text))
     }
 
+    if let Some(ref cfg) = item.attrs.cfg {
+        stability.push(format!("<div class='stab portability'>{}</div>", if show_reason {
+            cfg.render_long_html()
+        } else {
+            cfg.render_short_html()
+        }));
+    }
+
     stability
 }
 
diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css
index 034c5307fc0..08bf5a10fe9 100644
--- a/src/librustdoc/html/static/styles/main.css
+++ b/src/librustdoc/html/static/styles/main.css
@@ -152,6 +152,7 @@ a.test-arrow {
 
 .stab.unstable { background: #FFF5D6; border-color: #FFC600; }
 .stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
+.stab.portability { background: #C4ECFF; border-color: #7BA5DB; }
 
 #help > div {
 	background: #e9e9e9;