Skip to content

Commit 98f4863

Browse files
committed
rustdoc: Inline items from foreign mods
These were all just previously skipped. Closes #15648
1 parent 8d7eb05 commit 98f4863

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,27 +364,33 @@ fn build_impl(cx: &core::DocContext,
364364
fn build_module(cx: &core::DocContext, tcx: &ty::ctxt,
365365
did: ast::DefId) -> clean::Module {
366366
let mut items = Vec::new();
367+
fill_in(cx, tcx, did, &mut items);
368+
return clean::Module {
369+
items: items,
370+
is_crate: false,
371+
};
367372

368373
// FIXME: this doesn't handle reexports inside the module itself.
369374
// Should they be handled?
370-
csearch::each_child_of_item(&tcx.sess.cstore, did, |def, _, vis| {
371-
if vis != ast::Public { return }
372-
match def {
373-
decoder::DlDef(def) => {
374-
match try_inline_def(cx, tcx, def) {
375-
Some(i) => items.extend(i.move_iter()),
376-
None => {}
375+
fn fill_in(cx: &core::DocContext, tcx: &ty::ctxt, did: ast::DefId,
376+
items: &mut Vec<clean::Item>) {
377+
csearch::each_child_of_item(&tcx.sess.cstore, did, |def, _, vis| {
378+
match def {
379+
decoder::DlDef(def::DefForeignMod(did)) => {
380+
fill_in(cx, tcx, did, items);
381+
}
382+
decoder::DlDef(def) if vis == ast::Public => {
383+
match try_inline_def(cx, tcx, def) {
384+
Some(i) => items.extend(i.move_iter()),
385+
None => {}
386+
}
377387
}
388+
decoder::DlDef(..) => {}
389+
// All impls were inlined above
390+
decoder::DlImpl(..) => {}
391+
decoder::DlField => fail!("unimplemented field"),
378392
}
379-
// All impls were inlined above
380-
decoder::DlImpl(..) => {}
381-
decoder::DlField => fail!("unimplemented field"),
382-
}
383-
});
384-
385-
clean::Module {
386-
items: items,
387-
is_crate: false,
393+
});
388394
}
389395
}
390396

0 commit comments

Comments
 (0)