Skip to content

Commit a1ccff7

Browse files
committed
Auto merge of #148035 - bjorn3:check_skip_codegen_crate, r=madsmtm
Skip codegen_crate call in check mode This way we don't have to spawn the coordinator thread. Some errors will no longer be emitted with this in check mode. For example the check that `-Ctarget-cpu` is passed on targets that need this. Suggested by `@saethlin`
2 parents b98351b + b2646bc commit a1ccff7

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

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)