@@ -361,12 +361,26 @@ pub(crate) fn run_aot(
361
361
metadata : EncodedMetadata ,
362
362
need_metadata_module : bool ,
363
363
) -> Box < OngoingCodegen > {
364
+ // FIXME handle `-Ctarget-cpu=native`
365
+ let target_cpu = match tcx. sess . opts . cg . target_cpu {
366
+ Some ( ref name) => name,
367
+ None => tcx. sess . target . cpu . as_ref ( ) ,
368
+ }
369
+ . to_owned ( ) ;
370
+
364
371
let cgus = if tcx. sess . opts . output_types . should_codegen ( ) {
365
372
tcx. collect_and_partition_mono_items ( ( ) ) . 1
366
373
} else {
367
374
// If only `--emit metadata` is used, we shouldn't perform any codegen.
368
375
// Also `tcx.collect_and_partition_mono_items` may panic in that case.
369
- & [ ]
376
+ return Box :: new ( OngoingCodegen {
377
+ modules : vec ! [ ] ,
378
+ allocator_module : None ,
379
+ metadata_module : None ,
380
+ metadata,
381
+ crate_info : CrateInfo :: new ( tcx, target_cpu) ,
382
+ concurrency_limiter : ConcurrencyLimiter :: new ( tcx. sess , 0 ) ,
383
+ } ) ;
370
384
} ;
371
385
372
386
if tcx. dep_graph . is_fully_enabled ( ) {
@@ -481,13 +495,6 @@ pub(crate) fn run_aot(
481
495
None
482
496
} ;
483
497
484
- // FIXME handle `-Ctarget-cpu=native`
485
- let target_cpu = match tcx. sess . opts . cg . target_cpu {
486
- Some ( ref name) => name,
487
- None => tcx. sess . target . cpu . as_ref ( ) ,
488
- }
489
- . to_owned ( ) ;
490
-
491
498
Box :: new ( OngoingCodegen {
492
499
modules,
493
500
allocator_module,
0 commit comments