diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 7e77781dc2fc..7bf1efc10653 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -671,18 +671,7 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box { } .to_owned(); - let cgus = if tcx.sess.opts.output_types.should_codegen() { - tcx.collect_and_partition_mono_items(()).codegen_units - } else { - // If only `--emit metadata` is used, we shouldn't perform any codegen. - // Also `tcx.collect_and_partition_mono_items` may panic in that case. - return Box::new(OngoingCodegen { - modules: vec![], - allocator_module: None, - crate_info: CrateInfo::new(tcx, target_cpu), - concurrency_limiter: ConcurrencyLimiter::new(0), - }); - }; + let cgus = tcx.collect_and_partition_mono_items(()).codegen_units; if tcx.dep_graph.is_fully_enabled() { for cgu in cgus { diff --git a/src/driver/jit.rs b/src/driver/jit.rs index b3497503bf06..fec46bf26975 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -33,9 +33,7 @@ fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule, CodegenCx) { } pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec) -> ! { - if !tcx.sess.opts.output_types.should_codegen() { - tcx.dcx().fatal("JIT mode doesn't work with `cargo check`"); - } + // FIXME error on check mode or crate types other than bin in CodegenBackend::init() if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) { tcx.dcx().fatal("can't jit non-executable crate");