File tree Expand file tree Collapse file tree
rustc_codegen_cranelift/src/driver
rustc_codegen_ssa/src/back
rustc_incremental/src/persist Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,11 +81,9 @@ impl OngoingCodegen {
8181 } ;
8282 let ModuleCodegenResult { module, existing_work_product } = module_codegen_result;
8383
84- if let Some ( ( work_product_id, work_product) ) = existing_work_product {
85- work_products. insert ( work_product_id, work_product) ;
86- } else {
87- let work_product = if disable_incr_cache {
88- None
84+ if !disable_incr_cache {
85+ let ( id, product) = if let Some ( ( id, product) ) = existing_work_product {
86+ ( id, product)
8987 } else if let Some ( global_asm_object) = & module. global_asm_object {
9088 rustc_incremental:: copy_cgu_workproduct_to_incr_comp_cache_dir (
9189 sess,
@@ -101,9 +99,7 @@ impl OngoingCodegen {
10199 & [ ] ,
102100 )
103101 } ;
104- if let Some ( ( work_product_id, work_product) ) = work_product {
105- work_products. insert ( work_product_id, work_product) ;
106- }
102+ work_products. insert ( id, product) ;
107103 }
108104
109105 modules. push ( module) ;
Original file line number Diff line number Diff line change @@ -488,14 +488,13 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
488488 if let Some ( path) = & module. bytecode {
489489 files. push ( ( OutputType :: Bitcode . extension ( ) , path. as_path ( ) ) ) ;
490490 }
491- if let Some ( ( id, product) ) = copy_cgu_workproduct_to_incr_comp_cache_dir (
491+ let ( id, product) = copy_cgu_workproduct_to_incr_comp_cache_dir (
492492 sess,
493493 & module. name ,
494494 files. as_slice ( ) ,
495495 & module. links_from_incr_cache ,
496- ) {
497- work_products. insert ( id, product) ;
498- }
496+ ) ;
497+ work_products. insert ( id, product) ;
499498 }
500499
501500 work_products
Original file line number Diff line number Diff line change @@ -16,14 +16,16 @@ use crate::persist::fs::*;
1616
1717/// Copies a CGU work product to the incremental compilation directory, so next compilation can
1818/// find and reuse it.
19+ ///
20+ /// Must only be called when incr comp is enabled.
1921pub fn copy_cgu_workproduct_to_incr_comp_cache_dir (
2022 sess : & Session ,
2123 cgu_name : & str ,
2224 files : & [ ( & ' static str , & Path ) ] ,
2325 known_links : & [ PathBuf ] ,
24- ) -> Option < ( WorkProductId , WorkProduct ) > {
26+ ) -> ( WorkProductId , WorkProduct ) {
2527 debug ! ( ?cgu_name, ?files) ;
26- sess. opts . incremental . as_ref ( ) ? ;
28+ assert ! ( sess. opts. incremental. is_some ( ) ) ;
2729
2830 let mut saved_files = UnordMap :: default ( ) ;
2931 for ( ext, path) in files {
@@ -50,7 +52,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
5052 let work_product = WorkProduct { cgu_name : cgu_name. to_string ( ) , saved_files } ;
5153 debug ! ( ?work_product) ;
5254 let work_product_id = WorkProductId :: from_cgu_name ( cgu_name) ;
53- Some ( ( work_product_id, work_product) )
55+ ( work_product_id, work_product)
5456}
5557
5658/// Removes files for a given work product.
Original file line number Diff line number Diff line change @@ -89,14 +89,13 @@ impl Linker {
8989
9090 if sess. opts . incremental . is_some ( )
9191 && let Some ( path) = self . metadata . path ( )
92- && let Some ( ( id, product) ) =
93- rustc_incremental:: copy_cgu_workproduct_to_incr_comp_cache_dir (
94- sess,
95- "metadata" ,
96- & [ ( "rmeta" , path) ] ,
97- & [ ] ,
98- )
9992 {
93+ let ( id, product) = rustc_incremental:: copy_cgu_workproduct_to_incr_comp_cache_dir (
94+ sess,
95+ "metadata" ,
96+ & [ ( "rmeta" , path) ] ,
97+ & [ ] ,
98+ ) ;
10099 work_products. insert ( id, product) ;
101100 }
102101
You can’t perform that action at this time.
0 commit comments