parent
5b4a8091d5
commit
e64a7ebcb0
3 changed files with 15 additions and 2 deletions
|
@ -146,7 +146,13 @@ pub(super) fn run_aot(
|
||||||
) -> Box<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>)> {
|
) -> Box<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>)> {
|
||||||
let mut work_products = FxHashMap::default();
|
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() {
|
if tcx.dep_graph.is_fully_enabled() {
|
||||||
for cgu in &*cgus {
|
for cgu in &*cgus {
|
||||||
|
@ -239,6 +245,10 @@ pub(super) fn run_aot(
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if tcx.sess.opts.output_types.should_codegen() {
|
||||||
|
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||||
|
}
|
||||||
|
|
||||||
Box::new((CodegenResults {
|
Box::new((CodegenResults {
|
||||||
crate_name: tcx.crate_name(LOCAL_CRATE),
|
crate_name: tcx.crate_name(LOCAL_CRATE),
|
||||||
modules,
|
modules,
|
||||||
|
|
|
@ -39,6 +39,10 @@ pub(super) fn run_jit(tcx: TyCtxt<'_>) -> ! {
|
||||||
.declare_function("main", Linkage::Import, &sig)
|
.declare_function("main", Linkage::Import, &sig)
|
||||||
.unwrap();
|
.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 (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
||||||
let mono_items = cgus
|
let mono_items = cgus
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -200,7 +200,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||||
) -> Box<dyn Any> {
|
) -> Box<dyn Any> {
|
||||||
let res = driver::codegen_crate(tcx, metadata, need_metadata_module);
|
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);
|
rustc_symbol_mangling::test::report_symbol_names(tcx);
|
||||||
|
|
||||||
res
|
res
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue