Skip to content

Commit 5d765b8

Browse files
committed
Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu
Save/restore more items in cache with incremental compilation Right now they don't play very well together, consider a simple example: ``` $ export RUSTFLAGS="--emit asm" $ cargo new --lib foo Created library `foo` package $ cargo build -q $ touch src/lib.rs $ cargo build error: could not copy "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.4qbzn9k8mosu50a5.rcgu.s" to "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.s": No such file or directory (os error 2) ``` Touch triggers the rebuild, incremental compilation detects no changes (yay) and everything explodes while trying to copy files were they should go. This pull request fixes it by copying and restoring more files in the incremental compilation cache Fixes rust-lang/rust#89149 Fixes rust-lang/rust#88829 Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
2 parents 3549d98 + 6669758 commit 5d765b8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/driver/aot.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ fn emit_cgu(
341341
object: Some(global_asm_object_file),
342342
dwarf_object: None,
343343
bytecode: None,
344+
assembly: None,
345+
llvm_ir: None,
344346
}),
345347
existing_work_product: None,
346348
})
@@ -378,7 +380,15 @@ fn emit_module(
378380

379381
prof.artifact_size("object_file", &*name, file.metadata().unwrap().len());
380382

381-
Ok(CompiledModule { name, kind, object: Some(tmp_file), dwarf_object: None, bytecode: None })
383+
Ok(CompiledModule {
384+
name,
385+
kind,
386+
object: Some(tmp_file),
387+
dwarf_object: None,
388+
bytecode: None,
389+
assembly: None,
390+
llvm_ir: None,
391+
})
382392
}
383393

384394
fn reuse_workproduct_for_cgu(
@@ -426,13 +436,17 @@ fn reuse_workproduct_for_cgu(
426436
object: Some(obj_out_regular),
427437
dwarf_object: None,
428438
bytecode: None,
439+
assembly: None,
440+
llvm_ir: None,
429441
},
430442
module_global_asm: has_global_asm.then(|| CompiledModule {
431443
name: cgu.name().to_string(),
432444
kind: ModuleKind::Regular,
433445
object: Some(obj_out_global_asm),
434446
dwarf_object: None,
435447
bytecode: None,
448+
assembly: None,
449+
llvm_ir: None,
436450
}),
437451
existing_work_product: Some((cgu.work_product_id(), work_product)),
438452
})
@@ -678,6 +692,8 @@ pub(crate) fn run_aot(
678692
object: Some(tmp_file),
679693
dwarf_object: None,
680694
bytecode: None,
695+
assembly: None,
696+
llvm_ir: None,
681697
})
682698
} else {
683699
None

0 commit comments

Comments
 (0)