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.
This commit is contained in:
kennytm 2017-08-05 14:38:52 +08:00
parent 8f935fbb5b
commit a2b888675a
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
12 changed files with 1129 additions and 16 deletions

View file

@ -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
}

View file

@ -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;