@@ -98,7 +98,7 @@ fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option<File>) ->
98
98
fn run_aot < ' a , ' tcx : ' a > (
99
99
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
100
100
metadata : EncodedMetadata ,
101
- _need_metadata_module : bool ,
101
+ need_metadata_module : bool ,
102
102
log : & mut Option < File > ,
103
103
) -> Box < CodegenResults > {
104
104
let new_module = |name : String | {
@@ -166,7 +166,7 @@ fn run_aot<'a, 'tcx: 'a>(
166
166
rustc_incremental:: save_dep_graph ( tcx) ;
167
167
rustc_incremental:: finalize_session_directory ( tcx. sess , tcx. crate_hash ( LOCAL_CRATE ) ) ;
168
168
169
- let metadata_module = {
169
+ let metadata_module = if need_metadata_module {
170
170
use rustc:: mir:: mono:: CodegenUnitNameBuilder ;
171
171
172
172
let cgu_name_builder = & mut CodegenUnitNameBuilder :: new ( tcx) ;
@@ -186,13 +186,15 @@ fn run_aot<'a, 'tcx: 'a>(
186
186
let obj = metadata_artifact. emit ( ) . unwrap ( ) ;
187
187
std:: fs:: write ( & tmp_file, obj) . unwrap ( ) ;
188
188
189
- CompiledModule {
189
+ Some ( CompiledModule {
190
190
name : metadata_cgu_name,
191
191
kind : ModuleKind :: Metadata ,
192
192
object : Some ( tmp_file) ,
193
193
bytecode : None ,
194
194
bytecode_compressed : None ,
195
- }
195
+ } )
196
+ } else {
197
+ None
196
198
} ;
197
199
198
200
Box :: new ( CodegenResults {
@@ -213,7 +215,7 @@ fn run_aot<'a, 'tcx: 'a>(
213
215
} else {
214
216
None
215
217
} ,
216
- metadata_module : Some ( metadata_module ) ,
218
+ metadata_module,
217
219
crate_hash : tcx. crate_hash ( LOCAL_CRATE ) ,
218
220
metadata,
219
221
windows_subsystem : None , // Windows is not yet supported
0 commit comments