@@ -540,9 +540,12 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
540
540
if let Some ( path) = & module. bytecode {
541
541
files. push ( ( OutputType :: Bitcode . extension ( ) , path. as_path ( ) ) ) ;
542
542
}
543
- if let Some ( ( id, product) ) =
544
- copy_cgu_workproduct_to_incr_comp_cache_dir ( sess, & module. name , files. as_slice ( ) )
545
- {
543
+ if let Some ( ( id, product) ) = copy_cgu_workproduct_to_incr_comp_cache_dir (
544
+ sess,
545
+ & module. name ,
546
+ files. as_slice ( ) ,
547
+ & module. links_from_incr_cache ,
548
+ ) {
546
549
work_products. insert ( id, product) ;
547
550
}
548
551
}
@@ -934,7 +937,9 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
934
937
) -> WorkItemResult < B > {
935
938
let incr_comp_session_dir = cgcx. incr_comp_session_dir . as_ref ( ) . unwrap ( ) ;
936
939
937
- let load_from_incr_comp_dir = |output_path : PathBuf , saved_path : & str | {
940
+ let mut links_from_incr_cache = Vec :: new ( ) ;
941
+
942
+ let mut load_from_incr_comp_dir = |output_path : PathBuf , saved_path : & str | {
938
943
let source_file = in_incr_comp_dir ( incr_comp_session_dir, saved_path) ;
939
944
debug ! (
940
945
"copying preexisting module `{}` from {:?} to {}" ,
@@ -943,7 +948,10 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
943
948
output_path. display( )
944
949
) ;
945
950
match link_or_copy ( & source_file, & output_path) {
946
- Ok ( _) => Some ( output_path) ,
951
+ Ok ( _) => {
952
+ links_from_incr_cache. push ( source_file) ;
953
+ Some ( output_path)
954
+ }
947
955
Err ( error) => {
948
956
cgcx. create_dcx ( ) . handle ( ) . emit_err ( errors:: CopyPathBuf {
949
957
source_file,
@@ -966,7 +974,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
966
974
load_from_incr_comp_dir ( dwarf_obj_out, saved_dwarf_object_file)
967
975
} ) ;
968
976
969
- let load_from_incr_cache = |perform, output_type : OutputType | {
977
+ let mut load_from_incr_cache = |perform, output_type : OutputType | {
970
978
if perform {
971
979
let saved_file = module. source . saved_files . get ( output_type. extension ( ) ) ?;
972
980
let output_path = cgcx. output_filenames . temp_path ( output_type, Some ( & module. name ) ) ;
@@ -986,6 +994,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
986
994
}
987
995
988
996
WorkItemResult :: Finished ( CompiledModule {
997
+ links_from_incr_cache,
989
998
name : module. name ,
990
999
kind : ModuleKind :: Regular ,
991
1000
object,
0 commit comments