mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
parent
5b4a8091d5
commit
e64a7ebcb0
@ -146,7 +146,13 @@ pub(super) fn run_aot(
|
||||
) -> Box<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>)> {
|
||||
let mut work_products = FxHashMap::default();
|
||||
|
||||
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
||||
let cgus = if tcx.sess.opts.output_types.should_codegen() {
|
||||
tcx.collect_and_partition_mono_items(LOCAL_CRATE).1
|
||||
} 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.
|
||||
&[]
|
||||
};
|
||||
|
||||
if tcx.dep_graph.is_fully_enabled() {
|
||||
for cgu in &*cgus {
|
||||
@ -239,6 +245,10 @@ pub(super) fn run_aot(
|
||||
None
|
||||
};
|
||||
|
||||
if tcx.sess.opts.output_types.should_codegen() {
|
||||
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||
}
|
||||
|
||||
Box::new((CodegenResults {
|
||||
crate_name: tcx.crate_name(LOCAL_CRATE),
|
||||
modules,
|
||||
|
@ -39,6 +39,10 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
|
||||
.declare_function("main", Linkage::Import, &sig)
|
||||
.unwrap();
|
||||
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
tcx.sess.fatal("JIT mode doesn't work with `cargo check`.");
|
||||
}
|
||||
|
||||
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
||||
let mono_items = cgus
|
||||
.iter()
|
||||
|
@ -200,7 +200,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||
) -> Box<dyn Any> {
|
||||
let res = driver::codegen_crate(tcx, metadata, need_metadata_module);
|
||||
|
||||
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||
rustc_symbol_mangling::test::report_symbol_names(tcx);
|
||||
|
||||
res
|
||||
|
Loading…
Reference in New Issue
Block a user