Skip to content

Commit b548b29

Browse files
committed
Skip codegen_crate call in check mode
1 parent cc27b04 commit b548b29

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/driver/aot.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -671,18 +671,7 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
671671
}
672672
.to_owned();
673673

674-
let cgus = if tcx.sess.opts.output_types.should_codegen() {
675-
tcx.collect_and_partition_mono_items(()).codegen_units
676-
} else {
677-
// If only `--emit metadata` is used, we shouldn't perform any codegen.
678-
// Also `tcx.collect_and_partition_mono_items` may panic in that case.
679-
return Box::new(OngoingCodegen {
680-
modules: vec![],
681-
allocator_module: None,
682-
crate_info: CrateInfo::new(tcx, target_cpu),
683-
concurrency_limiter: ConcurrencyLimiter::new(0),
684-
});
685-
};
674+
let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
686675

687676
if tcx.dep_graph.is_fully_enabled() {
688677
for cgu in cgus {

src/driver/jit.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ fn create_jit_module(tcx: TyCtxt<'_>) -> (UnwindModule<JITModule>, CodegenCx) {
3333
}
3434

3535
pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
36-
if !tcx.sess.opts.output_types.should_codegen() {
37-
tcx.dcx().fatal("JIT mode doesn't work with `cargo check`");
38-
}
36+
// FIXME error on check mode or crate types other than bin in CodegenBackend::init()
3937

4038
if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) {
4139
tcx.dcx().fatal("can't jit non-executable crate");

0 commit comments

Comments
 (0)