about summary refs log tree commit diff
path: root/src/librustdoc/clean/inline.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/clean/inline.rs')
-rw-r--r--src/librustdoc/clean/inline.rs27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 9eac2fd41fa..8f878264769 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -260,6 +260,11 @@ pub fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
             match def {
                 cstore::DlImpl(did) => build_impl(cx, tcx, did, impls),
                 cstore::DlDef(Def::Mod(did)) => {
+                    // Don't recurse if this is a #[doc(hidden)] module
+                    if load_attrs(cx, tcx, did).iter().any(|a| is_doc_hidden(a)) {
+                        return;
+                    }
+
                     for item in tcx.sess.cstore.item_children(did) {
                         populate_impls(cx, tcx, item.def, impls)
                     }
@@ -423,19 +428,19 @@ pub fn build_impl(cx: &DocContext,
         deprecation: stability::lookup_deprecation(tcx, did).clean(cx),
         def_id: did,
     });
+}
 
-    fn is_doc_hidden(a: &clean::Attribute) -> bool {
-        match *a {
-            clean::List(ref name, ref inner) if *name == "doc" => {
-                inner.iter().any(|a| {
-                    match *a {
-                        clean::Word(ref s) => *s == "hidden",
-                        _ => false,
-                    }
-                })
-            }
-            _ => false
+fn is_doc_hidden(a: &clean::Attribute) -> bool {
+    match *a {
+        clean::List(ref name, ref inner) if *name == "doc" => {
+            inner.iter().any(|a| {
+                match *a {
+                    clean::Word(ref s) => *s == "hidden",
+                    _ => false,
+                }
+            })
         }
+        _ => false
     }
 }