use cfg attribute instead of macro
This commit is contained in:
parent
1fca19c8ca
commit
78fbcca3e1
@ -14,6 +14,8 @@
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
use rustc_data_structures::sync::{par_iter, ParallelIterator};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
|
||||
@ -622,8 +624,8 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
// This likely is a temporary measure. Once we don't have to support the
|
||||
// non-parallel compiler anymore, we can compile CGUs end-to-end in
|
||||
// parallel and get rid of the complicated scheduling logic.
|
||||
#[cfg(parallel_compiler)]
|
||||
let pre_compile_cgus = |cgu_reuse: &[CguReuse]| {
|
||||
if cfg!(parallel_compiler) {
|
||||
tcx.sess.time("compile_first_CGU_batch", || {
|
||||
// Try to find one CGU to compile per thread.
|
||||
let cgus: Vec<_> = cgu_reuse
|
||||
@ -645,11 +647,11 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
|
||||
(pre_compiled_cgus, start_time.elapsed())
|
||||
})
|
||||
} else {
|
||||
(FxHashMap::default(), Duration::new(0, 0))
|
||||
}
|
||||
};
|
||||
|
||||
#[cfg(not(parallel_compiler))]
|
||||
let pre_compile_cgus = |_: &[CguReuse]| (FxHashMap::default(), Duration::new(0, 0));
|
||||
|
||||
let mut cgu_reuse = Vec::new();
|
||||
let mut pre_compiled_cgus: Option<FxHashMap<usize, _>> = None;
|
||||
let mut total_codegen_time = Duration::new(0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user