@@ -194,7 +194,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
194
194
& self ,
195
195
tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
196
196
metadata : EncodedMetadata ,
197
- _need_metadata_module : bool ,
197
+ need_metadata_module : bool ,
198
198
_rx : mpsc:: Receiver < Box < dyn Any + Send > > ,
199
199
) -> Box < dyn Any > {
200
200
env_logger:: init ( ) ;
@@ -323,7 +323,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
323
323
rustc_incremental:: save_dep_graph ( tcx) ;
324
324
rustc_incremental:: finalize_session_directory ( tcx. sess , tcx. crate_hash ( LOCAL_CRATE ) ) ;
325
325
326
- let metadata_module = {
326
+ let metadata_module = if need_metadata_module {
327
327
use rustc:: mir:: mono:: CodegenUnitNameBuilder ;
328
328
329
329
let cgu_name_builder = & mut CodegenUnitNameBuilder :: new ( tcx) ;
@@ -342,13 +342,15 @@ impl CodegenBackend for CraneliftCodegenBackend {
342
342
let obj = metadata_artifact. emit ( ) . unwrap ( ) ;
343
343
std:: fs:: write ( & tmp_file, obj) . unwrap ( ) ;
344
344
345
- CompiledModule {
345
+ Some ( CompiledModule {
346
346
name : metadata_cgu_name,
347
347
kind : ModuleKind :: Metadata ,
348
348
object : Some ( tmp_file) ,
349
349
bytecode : None ,
350
350
bytecode_compressed : None ,
351
- }
351
+ } )
352
+ } else {
353
+ None
352
354
} ;
353
355
354
356
return Box :: new ( CodegenResults {
@@ -369,7 +371,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
369
371
} else {
370
372
None
371
373
} ,
372
- metadata_module : Some ( metadata_module ) ,
374
+ metadata_module,
373
375
crate_hash : tcx. crate_hash ( LOCAL_CRATE ) ,
374
376
metadata,
375
377
windows_subsystem : None , // Windows is not yet supported
0 commit comments