@@ -17,7 +17,7 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}
1717use rustc_hir:: definitions:: { DefKey , DefPath , DefPathData , DefPathHash } ;
1818use rustc_hir:: diagnostic_items:: DiagnosticItems ;
1919use rustc_index:: { Idx , IndexVec } ;
20- use rustc_middle:: metadata:: ModChild ;
20+ use rustc_middle:: metadata:: { ModChild , ModChildData } ;
2121use rustc_middle:: middle:: exported_symbols:: { ExportedSymbol , SymbolExportInfo } ;
2222use rustc_middle:: mir:: interpret:: { AllocDecodingSession , AllocDecodingState } ;
2323use rustc_middle:: ty:: codec:: TyDecoder ;
@@ -904,15 +904,17 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
904904 let variants = if let ty:: AdtKind :: Enum = adt_kind {
905905 self . root
906906 . tables
907- . module_children_non_reexports
907+ . module_children
908908 . get ( self , item_id)
909909 . expect ( "variants are not encoded for an enum" )
910910 . decode ( self )
911- . filter_map ( |index| {
912- let kind = self . def_kind ( index) ;
911+ . filter_map ( |child| {
912+ let ModChild :: Def ( def_id) = child else { bug ! ( ) } ;
913+ assert_eq ! ( def_id. krate, self . cnum) ;
914+ let kind = self . def_kind ( def_id. index ) ;
913915 match kind {
914916 DefKind :: Ctor ( ..) => None ,
915- _ => Some ( self . get_variant ( & kind, index, did) ) ,
917+ _ => Some ( self . get_variant ( & kind, def_id . index , did) ) ,
916918 }
917919 } )
918920 . collect ( )
@@ -988,12 +990,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
988990 DiagnosticItems { id_to_name, name_to_id }
989991 }
990992
991- fn get_mod_child ( self , id : DefIndex , sess : & Session ) -> ModChild {
993+ fn get_mod_child_data ( self , id : DefIndex , sess : & Session ) -> ModChildData {
992994 let ident = self . item_ident ( id, sess) ;
993995 let res = Res :: Def ( self . def_kind ( id) , self . local_def_id ( id) ) ;
994996 let vis = self . get_visibility ( id) ;
995997
996- ModChild { ident, res, vis, reexport_chain : Default :: default ( ) }
998+ ModChildData { ident, res, vis, reexport_chain : Default :: default ( ) }
997999 }
9981000
9991001 /// Iterates over all named children of the given module,
@@ -1011,21 +1013,15 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
10111013 // the view of this crate as a proc macro crate.
10121014 if id == CRATE_DEF_INDEX {
10131015 for child_index in data. macros . decode ( self ) {
1014- yield self . get_mod_child ( child_index, sess ) ;
1016+ yield ModChild :: Def ( self . local_def_id ( child_index) ) ;
10151017 }
10161018 }
10171019 } else {
10181020 // Iterate over all children.
1019- let non_reexports = self . root . tables . module_children_non_reexports . get ( self , id) ;
1020- for child_index in non_reexports. unwrap ( ) . decode ( self ) {
1021- yield self . get_mod_child ( child_index, sess) ;
1022- }
1023-
1024- let reexports = self . root . tables . module_children_reexports . get ( self , id) ;
1025- if !reexports. is_default ( ) {
1026- for reexport in reexports. decode ( ( self , sess) ) {
1027- yield reexport;
1028- }
1021+ for child in
1022+ self . root . tables . module_children . get ( self , id) . unwrap ( ) . decode ( ( self , sess) )
1023+ {
1024+ yield child;
10291025 }
10301026 }
10311027 } )
0 commit comments