2121
2222#![ feature( box_syntax) ]
2323
24+ use std:: any:: Any ;
2425use std:: io:: prelude:: * ;
2526use std:: io:: { self , Cursor } ;
2627use std:: fs:: File ;
2728use std:: path:: Path ;
29+ use std:: sync:: mpsc;
2830
2931use owning_ref:: { ErasedBoxRef , OwningRef } ;
3032use ar:: { Archive , Builder , Header } ;
@@ -35,13 +37,12 @@ use syntax::symbol::Symbol;
3537use rustc:: hir:: def_id:: LOCAL_CRATE ;
3638use rustc:: session:: Session ;
3739use rustc:: session:: config:: { CrateType , OutputFilenames } ;
38- use rustc:: ty:: { CrateAnalysis , TyCtxt } ;
40+ use rustc:: ty:: TyCtxt ;
3941use rustc:: ty:: maps:: Providers ;
4042use rustc:: middle:: cstore:: EncodedMetadata ;
4143use rustc:: middle:: cstore:: MetadataLoader as MetadataLoaderTrait ;
42- use rustc:: dep_graph:: DepGraph ;
44+ use rustc:: dep_graph:: { DepGraph , DepNode , DepKind } ;
4345use rustc_back:: target:: Target ;
44- use rustc_incremental:: IncrementalHashesMap ;
4546use link:: { build_link_meta, out_filename} ;
4647
4748pub trait TransCrate {
@@ -50,12 +51,11 @@ pub trait TransCrate {
5051 type TranslatedCrate ;
5152
5253 fn metadata_loader ( ) -> Box < MetadataLoaderTrait > ;
53- fn provide ( _providers : & mut Providers ) ;
54+ fn provide_local ( _providers : & mut Providers ) ;
55+ fn provide_extern ( _providers : & mut Providers ) ;
5456 fn trans_crate < ' a , ' tcx > (
5557 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
56- analysis : CrateAnalysis ,
57- incr_hashes_map : IncrementalHashesMap ,
58- output_filenames : & OutputFilenames
58+ rx : mpsc:: Receiver < Box < Any + Send > >
5959 ) -> Self :: OngoingCrateTranslation ;
6060 fn join_trans (
6161 trans : Self :: OngoingCrateTranslation ,
@@ -77,15 +77,17 @@ impl TransCrate for DummyTransCrate {
7777 box DummyMetadataLoader ( ( ) )
7878 }
7979
80- fn provide ( _providers : & mut Providers ) {
81- bug ! ( "DummyTransCrate::provide" ) ;
80+ fn provide_local ( _providers : & mut Providers ) {
81+ bug ! ( "DummyTransCrate::provide_local" ) ;
82+ }
83+
84+ fn provide_extern ( _providers : & mut Providers ) {
85+ bug ! ( "DummyTransCrate::provide_extern" ) ;
8286 }
8387
8488 fn trans_crate < ' a , ' tcx > (
8589 _tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
86- _analysis : CrateAnalysis ,
87- _incr_hashes_map : IncrementalHashesMap ,
88- _output_filenames : & OutputFilenames
90+ _rx : mpsc:: Receiver < Box < Any + Send > >
8991 ) -> Self :: OngoingCrateTranslation {
9092 bug ! ( "DummyTransCrate::trans_crate" ) ;
9193 }
@@ -176,16 +178,18 @@ impl TransCrate for MetadataOnlyTransCrate {
176178 box NoLlvmMetadataLoader
177179 }
178180
179- fn provide ( _providers : & mut Providers ) { }
181+ fn provide_local ( _providers : & mut Providers ) { }
182+ fn provide_extern ( _providers : & mut Providers ) { }
180183
181184 fn trans_crate < ' a , ' tcx > (
182185 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
183- analysis : CrateAnalysis ,
184- incr_hashes_map : IncrementalHashesMap ,
185- _output_filenames : & OutputFilenames ,
186+ _rx : mpsc:: Receiver < Box < Any + Send > >
186187 ) -> Self :: OngoingCrateTranslation {
187- let link_meta = build_link_meta ( & incr_hashes_map) ;
188- let exported_symbols = :: find_exported_symbols ( tcx, & analysis. reachable ) ;
188+ let crate_hash = tcx. dep_graph
189+ . fingerprint_of ( & DepNode :: new_no_params ( DepKind :: Krate ) )
190+ . unwrap ( ) ;
191+ let link_meta = build_link_meta ( crate_hash) ;
192+ let exported_symbols = :: find_exported_symbols ( tcx) ;
189193 let ( metadata, _hashes) = tcx. encode_metadata ( & link_meta, & exported_symbols) ;
190194
191195 OngoingCrateTranslation {
0 commit comments