about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-16 16:36:45 -0700
committerbors <bors@rust-lang.org>2013-03-16 16:36:45 -0700
commit6307d24364c02ff636b6c76e0ac8b379d73b86f7 (patch)
treee5834c2559ee978b040c83098072927d3adf1791
parentb53da4b9dd977fdffba3f10e570d7c025238dec3 (diff)
parentdeeeaf0ddbe3c5244442f3d12d0eaed512d65e75 (diff)
downloadrust-6307d24364c02ff636b6c76e0ac8b379d73b86f7.tar.gz
rust-6307d24364c02ff636b6c76e0ac8b379d73b86f7.zip
auto merge of #5415 : brson/rust/rustdoc, r=thestinger
r? @thestinger 
-rw-r--r--src/librustdoc/prune_private_pass.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/librustdoc/prune_private_pass.rs b/src/librustdoc/prune_private_pass.rs
index 17f11de8aeb..67dbc659f9e 100644
--- a/src/librustdoc/prune_private_pass.rs
+++ b/src/librustdoc/prune_private_pass.rs
@@ -59,7 +59,19 @@ fn is_visible(srv: astsrv::Srv, doc: doc::ItemDoc) -> bool {
     do astsrv::exec(srv) |ctxt| {
         match ctxt.ast_map.get(&id) {
             ast_map::node_item(item, _) => {
-                item.vis == ast::public
+                match item.node {
+                    ast::item_impl(_, Some(_), _, _) => {
+                        // This is a trait implementation, make it visible
+                        // NOTE: This is not quite right since this could be an impl
+                        // of a private trait. We can't know that without running
+                        // resolve though.
+                        true
+                    }
+                    _ => {
+                        // Otherwise just look at the visibility
+                        item.vis == ast::public
+                    }
+                }
             }
             _ => util::unreachable()
         }
@@ -72,6 +84,16 @@ fn should_prune_items_without_pub_modifier() {
     fail_unless!(vec::is_empty(doc.cratemod().mods()));
 }
 
+#[test]
+fn unless_they_are_trait_impls() {
+    let doc = test::mk_doc(
+        ~" \
+          trait Foo { } \
+          impl Foo for int { } \
+          ");
+    fail_unless!(!doc.cratemod().impls().is_empty());
+}
+
 #[cfg(test)]
 pub mod test {
     use astsrv;