@@ -77,14 +77,14 @@ crate struct CrateMetadata {
77
77
/// Proc macro descriptions for this crate, if it's a proc macro crate.
78
78
crate raw_proc_macros : Option < & ' static [ ProcMacro ] > ,
79
79
/// Source maps for code from the crate.
80
- crate source_map_import_info : Once < Vec < ImportedSourceFile > > ,
80
+ source_map_import_info : Once < Vec < ImportedSourceFile > > ,
81
81
/// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
82
82
crate alloc_decoding_state : AllocDecodingState ,
83
83
/// The `DepNodeIndex` of the `DepNode` representing this upstream crate.
84
84
/// It is initialized on the first access in `get_crate_dep_node_index()`.
85
85
/// Do not access the value directly, as it might not have been initialized yet.
86
86
/// The field must always be initialized to `DepNodeIndex::INVALID`.
87
- crate dep_node_index : AtomicCell < DepNodeIndex > ,
87
+ dep_node_index : AtomicCell < DepNodeIndex > ,
88
88
89
89
// --- Other significant crate properties ---
90
90
@@ -113,6 +113,41 @@ crate struct CrateMetadata {
113
113
}
114
114
115
115
impl < ' 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
+
116
151
crate fn is_proc_macro_crate ( & self ) -> bool {
117
152
self . root . proc_macro_decls_static . is_some ( )
118
153
}
0 commit comments