@@ -27,7 +27,7 @@ use rustc::ty::{self, Ty, TyCtxt, ReprOptions};
2727use rustc:: ty:: codec:: { self as ty_codec, TyEncoder } ;
2828
2929use rustc:: session:: config:: { self , CrateTypeProcMacro } ;
30- use rustc:: util:: nodemap:: { FxHashMap , NodeSet } ;
30+ use rustc:: util:: nodemap:: { FxHashMap , DefIdSet } ;
3131
3232use rustc_data_structures:: stable_hasher:: StableHasher ;
3333use rustc_serialize:: { Encodable , Encoder , SpecializedEncoder , opaque} ;
@@ -53,7 +53,6 @@ pub struct EncodeContext<'a, 'tcx: 'a> {
5353 opaque : opaque:: Encoder < ' a > ,
5454 pub tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
5555 link_meta : & ' a LinkMeta ,
56- reachable_non_generics : & ' a NodeSet ,
5756
5857 lazy_state : LazyState ,
5958 type_shorthands : FxHashMap < Ty < ' tcx > , usize > ,
@@ -395,9 +394,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
395394
396395 // Encode exported symbols info.
397396 i = self . position ( ) ;
397+ let reachable_non_generics = self . tcx . reachable_non_generics ( LOCAL_CRATE ) ;
398398 let reachable_non_generics = self . tracked (
399399 IsolatedEncoder :: encode_reachable_non_generics,
400- self . reachable_non_generics ) ;
400+ & reachable_non_generics) ;
401401 let reachable_non_generics_bytes = self . position ( ) - i;
402402
403403 // Encode and index the items.
@@ -1389,11 +1389,12 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
13891389 // symbol associated with them (they weren't translated) or if they're an FFI
13901390 // definition (as that's not defined in this crate).
13911391 fn encode_reachable_non_generics ( & mut self ,
1392- reachable_non_generics : & NodeSet )
1392+ reachable_non_generics : & DefIdSet )
13931393 -> LazySeq < DefIndex > {
1394- let tcx = self . tcx ;
1395- self . lazy_seq ( reachable_non_generics. iter ( )
1396- . map ( |& id| tcx. hir . local_def_id ( id) . index ) )
1394+ self . lazy_seq ( reachable_non_generics. iter ( ) . map ( |def_id| {
1395+ debug_assert ! ( def_id. is_local( ) ) ;
1396+ def_id. index
1397+ } ) )
13971398 }
13981399
13991400 fn encode_dylib_dependency_formats ( & mut self , _: ( ) ) -> LazySeq < Option < LinkagePreference > > {
@@ -1666,8 +1667,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> {
16661667// generated regardless of trailing bytes that end up in it.
16671668
16681669pub fn encode_metadata < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
1669- link_meta : & LinkMeta ,
1670- reachable_non_generics : & NodeSet )
1670+ link_meta : & LinkMeta )
16711671 -> EncodedMetadata
16721672{
16731673 let mut cursor = Cursor :: new ( vec ! [ ] ) ;
@@ -1681,7 +1681,6 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
16811681 opaque : opaque:: Encoder :: new ( & mut cursor) ,
16821682 tcx,
16831683 link_meta,
1684- reachable_non_generics,
16851684 lazy_state : LazyState :: NoNode ,
16861685 type_shorthands : Default :: default ( ) ,
16871686 predicate_shorthands : Default :: default ( ) ,
0 commit comments