@@ -77,14 +77,14 @@ crate struct CrateMetadata {
7777 /// Proc macro descriptions for this crate, if it's a proc macro crate.
7878 crate raw_proc_macros : Option < & ' static [ ProcMacro ] > ,
7979 /// Source maps for code from the crate.
80- crate source_map_import_info : Once < Vec < ImportedSourceFile > > ,
80+ source_map_import_info : Once < Vec < ImportedSourceFile > > ,
8181 /// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
8282 crate alloc_decoding_state : AllocDecodingState ,
8383 /// The `DepNodeIndex` of the `DepNode` representing this upstream crate.
8484 /// It is initialized on the first access in `get_crate_dep_node_index()`.
8585 /// Do not access the value directly, as it might not have been initialized yet.
8686 /// The field must always be initialized to `DepNodeIndex::INVALID`.
87- crate dep_node_index : AtomicCell < DepNodeIndex > ,
87+ dep_node_index : AtomicCell < DepNodeIndex > ,
8888
8989 // --- Other significant crate properties ---
9090
@@ -113,6 +113,41 @@ crate struct CrateMetadata {
113113}
114114
115115impl < ' a , ' tcx > CrateMetadata {
116+ crate fn new (
117+ def_path_table : DefPathTable ,
118+ trait_impls : FxHashMap < ( u32 , DefIndex ) , schema:: Lazy < [ DefIndex ] > > ,
119+ root : schema:: CrateRoot < ' static > ,
120+ host_hash : Option < Svh > ,
121+ blob : MetadataBlob ,
122+ cnum_map : CrateNumMap ,
123+ cnum : CrateNum ,
124+ dependencies : Vec < CrateNum > ,
125+ interpret_alloc_index : Vec < u32 > ,
126+ dep_kind : DepKind ,
127+ source : CrateSource ,
128+ private_dep : bool ,
129+ raw_proc_macros : Option < & ' static [ ProcMacro ] > ,
130+ ) -> Self {
131+ Self {
132+ extern_crate : Lock :: new ( None ) ,
133+ def_path_table,
134+ trait_impls,
135+ root,
136+ host_hash,
137+ blob,
138+ cnum_map,
139+ cnum,
140+ dependencies : Lock :: new ( dependencies) ,
141+ source_map_import_info : Once :: new ( ) ,
142+ alloc_decoding_state : AllocDecodingState :: new ( interpret_alloc_index) ,
143+ dep_kind : Lock :: new ( dep_kind) ,
144+ source,
145+ private_dep,
146+ raw_proc_macros,
147+ dep_node_index : AtomicCell :: new ( DepNodeIndex :: INVALID ) ,
148+ }
149+ }
150+
116151 crate fn is_proc_macro_crate ( & self ) -> bool {
117152 self . root . proc_macro_decls_static . is_some ( )
118153 }
0 commit comments