Skip to content

Commit fa706d4

Browse files
committed
Use -Zdisable-incr-comp-backend-caching instead of an env var
1 parent 7583ec5 commit fa706d4

3 files changed

Lines changed: 4 additions & 11 deletions

File tree

build_system/build_sysroot.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ fn build_clif_sysroot_for_triple(
231231
// inlining.
232232
rustflags.push("-Zinline-mir".to_owned());
233233

234+
rustflags.push("-Zdisable-incr-comp-backend-caching".to_owned());
235+
234236
if let Some(prefix) = env::var_os("CG_CLIF_STDLIB_REMAP_PATH_PREFIX") {
235237
rustflags.push("--remap-path-prefix".to_owned());
236238
rustflags.push(format!("library/={}/library", prefix.to_str().unwrap()));

build_system/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ fn main() {
5959
if env::var_os("RUST_BACKTRACE").is_none() {
6060
env::set_var("RUST_BACKTRACE", "1");
6161
}
62-
env::set_var("CG_CLIF_DISABLE_INCR_CACHE", "1");
6362

6463
let mut args = env::args().skip(1);
6564
let command = match args.next().as_deref() {

src/driver/aot.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! The AOT driver uses [`cranelift_object`] to write object files suitable for linking into a
22
//! standalone executable.
33
4-
use std::env;
54
use std::fs::File;
65
use std::io::BufWriter;
76
use std::path::PathBuf;
@@ -30,10 +29,6 @@ use crate::global_asm::{GlobalAsmConfig, GlobalAsmContext};
3029
use crate::prelude::*;
3130
use 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-
3732
struct 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

Comments
 (0)