@@ -361,12 +361,26 @@ pub(crate) fn run_aot(
361361 metadata : EncodedMetadata ,
362362 need_metadata_module : bool ,
363363) -> 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+
364371 let cgus = if tcx. sess . opts . output_types . should_codegen ( ) {
365372 tcx. collect_and_partition_mono_items ( ( ) ) . 1
366373 } else {
367374 // If only `--emit metadata` is used, we shouldn't perform any codegen.
368375 // 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+ } ) ;
370384 } ;
371385
372386 if tcx. dep_graph . is_fully_enabled ( ) {
@@ -481,13 +495,6 @@ pub(crate) fn run_aot(
481495 None
482496 } ;
483497
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-
491498 Box :: new ( OngoingCodegen {
492499 modules,
493500 allocator_module,
0 commit comments