File tree Expand file tree Collapse file tree
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 @@ -489,14 +489,13 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
489489 if let Some ( path) = & module. bytecode {
490490 files. push ( ( OutputType :: Bitcode . extension ( ) , path. as_path ( ) ) ) ;
491491 }
492- if let Some ( ( id, product) ) = copy_cgu_workproduct_to_incr_comp_cache_dir (
492+ let ( id, product) = copy_cgu_workproduct_to_incr_comp_cache_dir (
493493 sess,
494494 & module. name ,
495495 files. as_slice ( ) ,
496496 & module. links_from_incr_cache ,
497- ) {
498- work_products. insert ( id, product) ;
499- }
497+ ) ;
498+ work_products. insert ( id, product) ;
500499 }
501500
502501 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+ /// Panics when incr comp is disabled.
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