rustdoc: Render stability attributes

Closes #8965
This commit is contained in:
Alex Crichton
2013-09-26 12:53:06 -07:00
parent 6a277dc4ba
commit 42bcf638b0
4 changed files with 49 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ use extra::json::ToJson;
use extra::sort;
use syntax::ast;
use syntax::attr;
use clean;
use doctree;
@@ -568,6 +569,18 @@ impl<'self> Item<'self> {
impl<'self> fmt::Default for Item<'self> {
fn fmt(it: &Item<'self>, fmt: &mut fmt::Formatter) {
match attr::find_stability(it.item.attrs.iter()) {
Some(stability) => {
write!(fmt.buf,
"<a class='stability {lvl}' title='{reason}'>{lvl}</a>",
lvl = stability.level.to_str(),
reason = match stability.text {
Some(s) => s, None => @"",
});
}
None => {}
}
// Write the breadcrumb trail header for the top
write!(fmt.buf, "<h1 class='fqn'>");
match it.item.inner {