@@ -1575,8 +1575,12 @@ fn try_inline(id: ast::NodeId) -> Option<Vec<Item>> {
1575
1575
} ;
1576
1576
let did = ast_util:: def_id_of_def ( def) ;
1577
1577
if ast_util:: is_local ( did) { return None }
1578
+ try_inline_def ( tcx, def)
1579
+ }
1578
1580
1581
+ fn try_inline_def ( tcx : & ty:: ctxt , def : ast:: Def ) -> Option < Vec < Item > > {
1579
1582
let mut ret = Vec :: new ( ) ;
1583
+ let did = ast_util:: def_id_of_def ( def) ;
1580
1584
let inner = match def {
1581
1585
ast:: DefTrait ( did) => TraitItem ( build_external_trait ( tcx, did) ) ,
1582
1586
ast:: DefFn ( did, style) =>
@@ -1592,6 +1596,7 @@ fn try_inline(id: ast::NodeId) -> Option<Vec<Item>> {
1592
1596
// Assume that the enum type is reexported next to the variant, and
1593
1597
// variants don't show up in documentation specially.
1594
1598
ast:: DefVariant ( ..) => return Some ( Vec :: new ( ) ) ,
1599
+ ast:: DefMod ( did) => ModuleItem ( build_module ( tcx, did) ) ,
1595
1600
_ => return None ,
1596
1601
} ;
1597
1602
let fqn = csearch:: get_item_path ( tcx, did) ;
@@ -1995,6 +2000,28 @@ fn build_impl(tcx: &ty::ctxt, did: ast::DefId) -> Item {
1995
2000
}
1996
2001
}
1997
2002
2003
+ fn build_module ( tcx : & ty:: ctxt , did : ast:: DefId ) -> Module {
2004
+ let mut items = Vec :: new ( ) ;
2005
+
2006
+ csearch:: each_child_of_item ( & tcx. sess . cstore , did, |def, _, _| {
2007
+ match def {
2008
+ decoder:: DlDef ( def) => {
2009
+ match try_inline_def ( tcx, def) {
2010
+ Some ( i) => items. extend ( i. move_iter ( ) ) ,
2011
+ None => { }
2012
+ }
2013
+ }
2014
+ decoder:: DlImpl ( did) => items. push ( build_impl ( tcx, did) ) ,
2015
+ decoder:: DlField => fail ! ( "unimplemented field" ) ,
2016
+ }
2017
+ } ) ;
2018
+
2019
+ Module {
2020
+ items : items,
2021
+ is_crate : false ,
2022
+ }
2023
+ }
2024
+
1998
2025
fn resolve_use_source ( path : Path , id : ast:: NodeId ) -> ImportSource {
1999
2026
ImportSource {
2000
2027
path : path,
0 commit comments