about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-07-25 10:37:23 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-07-25 10:37:23 -0700
commit98f48630fc511c66b830571b028ebebe3911fa6f (patch)
treef1a97c6c23e2a8b91aa2c55d1c50d4f9c8b98ce0 /src
parent8d7eb0598a9147f0ec92b1f333360e5e912ab546 (diff)
downloadrust-98f48630fc511c66b830571b028ebebe3911fa6f.tar.gz
rust-98f48630fc511c66b830571b028ebebe3911fa6f.zip
rustdoc: Inline items from foreign mods
These were all just previously skipped.

Closes #15648
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/inline.rs38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 1e8964dd9db..2f7d766c28f 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -364,27 +364,33 @@ fn build_impl(cx: &core::DocContext,
 fn build_module(cx: &core::DocContext, tcx: &ty::ctxt,
                 did: ast::DefId) -> clean::Module {
     let mut items = Vec::new();
+    fill_in(cx, tcx, did, &mut items);
+    return clean::Module {
+        items: items,
+        is_crate: false,
+    };
 
     // FIXME: this doesn't handle reexports inside the module itself.
     //        Should they be handled?
-    csearch::each_child_of_item(&tcx.sess.cstore, did, |def, _, vis| {
-        if vis != ast::Public { return }
-        match def {
-            decoder::DlDef(def) => {
-                match try_inline_def(cx, tcx, def) {
-                    Some(i) => items.extend(i.move_iter()),
-                    None => {}
+    fn fill_in(cx: &core::DocContext, tcx: &ty::ctxt, did: ast::DefId,
+               items: &mut Vec<clean::Item>) {
+        csearch::each_child_of_item(&tcx.sess.cstore, did, |def, _, vis| {
+            match def {
+                decoder::DlDef(def::DefForeignMod(did)) => {
+                    fill_in(cx, tcx, did, items);
+                }
+                decoder::DlDef(def) if vis == ast::Public => {
+                    match try_inline_def(cx, tcx, def) {
+                        Some(i) => items.extend(i.move_iter()),
+                        None => {}
+                    }
                 }
+                decoder::DlDef(..) => {}
+                // All impls were inlined above
+                decoder::DlImpl(..) => {}
+                decoder::DlField => fail!("unimplemented field"),
             }
-            // All impls were inlined above
-            decoder::DlImpl(..) => {}
-            decoder::DlField => fail!("unimplemented field"),
-        }
-    });
-
-    clean::Module {
-        items: items,
-        is_crate: false,
+        });
     }
 }