33use crate :: cstore:: { self , CStore } ;
44use crate :: locator:: { CrateLocator , CratePaths } ;
55use crate :: rmeta:: { CrateRoot , CrateDep , MetadataBlob } ;
6- use rustc_data_structures:: sync:: { Lock , Once , AtomicCell } ;
76
87use rustc:: hir:: def_id:: CrateNum ;
98use rustc_data_structures:: svh:: Svh ;
10- use rustc:: dep_graph:: DepNodeIndex ;
119use rustc:: middle:: cstore:: DepKind ;
12- use rustc:: mir:: interpret:: AllocDecodingState ;
1310use rustc:: session:: { Session , CrateDisambiguator } ;
1411use rustc:: session:: config:: { Sanitizer , self } ;
1512use rustc_target:: spec:: { PanicStrategy , TargetTriple } ;
1613use rustc:: session:: search_paths:: PathKind ;
1714use rustc:: middle:: cstore:: { CrateSource , ExternCrate , ExternCrateSource , MetadataLoaderDyn } ;
18- use rustc:: util:: common:: record_time;
1915use rustc:: util:: nodemap:: FxHashSet ;
2016use rustc:: hir:: map:: Definitions ;
2117use rustc:: hir:: def_id:: LOCAL_CRATE ;
@@ -217,8 +213,6 @@ impl<'a> CrateLoader<'a> {
217213
218214 let cnum_map = self . resolve_crate_deps ( root, & crate_root, & metadata, cnum, span, dep_kind) ;
219215
220- let dependencies: Vec < CrateNum > = cnum_map. iter ( ) . cloned ( ) . collect ( ) ;
221-
222216 let raw_proc_macros = crate_root. proc_macro_data . map ( |_| {
223217 let temp_root;
224218 let ( dlsym_source, dlsym_root) = match & host_lib {
@@ -230,37 +224,18 @@ impl<'a> CrateLoader<'a> {
230224 self . dlsym_proc_macros ( & dlsym_dylib. 0 , dlsym_root. disambiguator , span)
231225 } ) ;
232226
233- let interpret_alloc_index: Vec < u32 > = crate_root. interpret_alloc_index
234- . decode ( & metadata)
235- . collect ( ) ;
236- let trait_impls = crate_root
237- . impls
238- . decode ( ( & metadata, self . sess ) )
239- . map ( |trait_impls| ( trait_impls. trait_id , trait_impls. impls ) )
240- . collect ( ) ;
241-
242- let def_path_table = record_time ( & self . sess . perf_stats . decode_def_path_tables_time , || {
243- crate_root. def_path_table . decode ( ( & metadata, self . sess ) )
244- } ) ;
245-
246- self . cstore . set_crate_data ( cnum, cstore:: CrateMetadata {
247- extern_crate : Lock :: new ( None ) ,
248- def_path_table,
249- trait_impls,
250- root : crate_root,
251- host_hash,
252- blob : metadata,
253- cnum_map,
227+ self . cstore . set_crate_data ( cnum, cstore:: CrateMetadata :: new (
228+ self . sess ,
229+ metadata,
230+ crate_root,
231+ raw_proc_macros,
254232 cnum,
255- dependencies : Lock :: new ( dependencies) ,
256- source_map_import_info : Once :: new ( ) ,
257- alloc_decoding_state : AllocDecodingState :: new ( interpret_alloc_index) ,
258- dep_kind : Lock :: new ( dep_kind) ,
233+ cnum_map,
234+ dep_kind,
259235 source,
260236 private_dep,
261- raw_proc_macros,
262- dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
263- } ) ;
237+ host_hash,
238+ ) ) ;
264239
265240 cnum
266241 }
0 commit comments