diff --git a/Readme.md b/Readme.md index 6759403b64f..61595e97730 100644 --- a/Readme.md +++ b/Readme.md @@ -69,7 +69,7 @@ function jit_calc() { to make it possible to use incremental mode for all analyses performed by rustc without caching object files when their content should have been changed by a change to cg_clif.
CG_CLIF_DISPLAY_CG_TIME
-
Display the time it took to perform codegen for a crate
+
If "1", display the time it took to perform codegen for a crate
## Not yet supported diff --git a/src/driver/mod.rs b/src/driver/mod.rs index d75b6e05f32..9a60b1e6a33 100644 --- a/src/driver/mod.rs +++ b/src/driver/mod.rs @@ -109,7 +109,7 @@ fn trans_mono_item<'tcx, B: Backend + 'static>( } fn time(tcx: TyCtxt<'_>, name: &'static str, f: impl FnOnce() -> R) -> R { - if std::env::var("CG_CLIF_DISPLAY_CG_TIME").is_ok() { + if std::env::var("CG_CLIF_DISPLAY_CG_TIME").as_ref().map(|val| &**val) == Ok("1") { println!("[{:<30}: {}] start", tcx.crate_name(LOCAL_CRATE), name); let before = std::time::Instant::now(); let res = tcx.sess.time(name, f);