11//! The AOT driver uses [`cranelift_object`] to write object files suitable for linking into a
22//! standalone executable.
33
4- use std:: env;
54use std:: fs:: File ;
65use std:: io:: BufWriter ;
76use std:: path:: PathBuf ;
@@ -30,10 +29,6 @@ use crate::global_asm::{GlobalAsmConfig, GlobalAsmContext};
3029use crate :: prelude:: * ;
3130use crate :: unwind_module:: UnwindModule ;
3231
33- fn disable_incr_cache ( ) -> bool {
34- env:: var ( "CG_CLIF_DISABLE_INCR_CACHE" ) . as_deref ( ) == Ok ( "1" )
35- }
36-
3732struct ModuleCodegenResult {
3833 module : CompiledModule ,
3934 existing_work_product : Option < ( WorkProductId , WorkProduct ) > ,
@@ -64,8 +59,6 @@ impl OngoingCodegen {
6459 ) -> ( CompiledModules , FxIndexMap < WorkProductId , WorkProduct > ) {
6560 let mut work_products = FxIndexMap :: default ( ) ;
6661 let mut modules = vec ! [ ] ;
67- let disable_incr_cache = disable_incr_cache ( ) ;
68-
6962 for module_codegen in self . modules {
7063 let module_codegen_result = match module_codegen {
7164 OngoingModuleCodegen :: Sync ( module_codegen_result) => module_codegen_result,
@@ -84,7 +77,7 @@ impl OngoingCodegen {
8477 if let Some ( ( work_product_id, work_product) ) = existing_work_product {
8578 work_products. insert ( work_product_id, work_product) ;
8679 } else {
87- let work_product = if disable_incr_cache {
80+ let work_product = if sess . opts . unstable_opts . disable_incr_comp_backend_caching {
8881 None
8982 } else if let Some ( global_asm_object) = & module. global_asm_object {
9083 rustc_incremental:: copy_cgu_workproduct_to_incr_comp_cache_dir (
@@ -458,10 +451,9 @@ pub(crate) fn run_aot(tcx: TyCtxt<'_>) -> Box<OngoingCodegen> {
458451
459452 let global_asm_config = Arc :: new ( crate :: global_asm:: GlobalAsmConfig :: new ( tcx) ) ;
460453
461- let disable_incr_cache = disable_incr_cache ( ) ;
462454 let ( todo_cgus, done_cgus) =
463455 cgus. iter ( ) . enumerate ( ) . partition :: < Vec < _ > , _ > ( |& ( i, _) | match cgu_reuse[ i] {
464- _ if disable_incr_cache => true ,
456+ _ if tcx . sess . opts . unstable_opts . disable_incr_comp_backend_caching => true ,
465457 CguReuse :: No => true ,
466458 CguReuse :: PreLto | CguReuse :: PostLto => false ,
467459 } ) ;
0 commit comments