Skip to content

Commit d82cf8a

Browse files
committed
rustdoc: Private modules should be included in docs
Changed `rustdoc` so that if we do not have the `strip-private` pass enabled private modules will be included in the generated documentation.
1 parent f187573 commit d82cf8a

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/librustdoc/html/render.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ impl Context {
11931193
// these modules are recursed into, but not rendered normally (a
11941194
// flag on the context).
11951195
if !self.render_redirect_pages {
1196-
self.render_redirect_pages = ignore_private_item(&item);
1196+
self.render_redirect_pages = ignore_empty_item(&item);
11971197
}
11981198

11991199
match item.inner {
@@ -1444,7 +1444,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
14441444
try!(document(w, item));
14451445

14461446
let mut indices = range(0, items.len()).filter(|i| {
1447-
!ignore_private_item(&items[*i])
1447+
!ignore_empty_item(&items[*i])
14481448
}).collect::<Vec<uint>>();
14491449

14501450
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
@@ -2161,7 +2161,7 @@ impl<'a> fmt::Show for Sidebar<'a> {
21612161
fn build_sidebar(m: &clean::Module) -> HashMap<String, Vec<String>> {
21622162
let mut map = HashMap::new();
21632163
for item in m.items.iter() {
2164-
if ignore_private_item(item) { continue }
2164+
if ignore_empty_item(item) { continue }
21652165

21662166
let short = shortty(item).to_static_str();
21672167
let myname = match item.name {
@@ -2215,13 +2215,11 @@ fn item_primitive(w: &mut fmt::Formatter,
22152215
render_methods(w, it)
22162216
}
22172217

2218-
fn ignore_private_item(it: &clean::Item) -> bool {
2218+
fn ignore_empty_item(it: &clean::Item) -> bool {
22192219
match it.inner {
22202220
clean::ModuleItem(ref m) => {
2221-
(m.items.len() == 0 && it.doc_value().is_none()) ||
2222-
it.visibility != Some(ast::Public)
2221+
(m.items.len() == 0 && it.doc_value().is_none())
22232222
}
2224-
clean::PrimitiveItem(..) => it.visibility != Some(ast::Public),
22252223
_ => false,
22262224
}
22272225
}

src/librustdoc/visit_ast.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
158158
}
159159

160160
pub fn visit_view_item(&mut self, item: &ast::ViewItem, om: &mut Module) {
161-
if item.vis != ast::Public {
162-
return om.view_items.push(item.clone());
163-
}
164161
let please_inline = item.attrs.iter().any(|item| {
165162
match item.meta_item_list() {
166163
Some(list) => {

0 commit comments

Comments
 (0)