auto merge of #9946 : sfackler/rust/enum-doc, r=alexcrichton

Struct fields with inherited visibility were previously stripped.

Closes #9899
This commit is contained in:
bors 2013-10-19 05:06:17 -07:00
commit 5751794d97
2 changed files with 27 additions and 1 deletions

View File

@ -1344,6 +1344,26 @@ fn item_enum(w: &mut io::Writer, it: &clean::Item, e: &clean::Enum) {
write!(w, "<tr><td id='variant.{name}'><code>{name}</code></td><td>",
name = variant.name.get_ref().as_slice());
document(w, variant);
match variant.inner {
clean::VariantItem(ref var) => {
match var.kind {
clean::StructVariant(ref s) => {
write!(w, "<h3 class='fields'>Fields</h3>\n<table>");
for field in s.fields.iter() {
write!(w, "<tr><td id='variant.{v}.field.{f}'>\
<code>{f}</code></td><td>",
v = variant.name.get_ref().as_slice(),
f = field.name.get_ref().as_slice());
document(w, field);
write!(w, "</td></tr>");
}
write!(w, "</table>");
}
_ => ()
}
}
_ => ()
}
write!(w, "</td></tr>");
}
write!(w, "</table>");

View File

@ -135,8 +135,14 @@ impl<'self> fold::DocFolder for Stripper<'self> {
}
}
clean::ViewItemItem(*) | clean::StructFieldItem(*) => {
clean::ViewItemItem(*) => {
if i.visibility != Some(ast::public) {
return None
}
}
clean::StructFieldItem(*) => {
if i.visibility == Some(ast::private) {
return None;
}
}