@@ -11,7 +11,9 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
11
11
use rustc_data_structures:: profiling:: { QueryInvocationId , SelfProfilerRef } ;
12
12
use rustc_data_structures:: sharded:: { self , Sharded } ;
13
13
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
14
- use rustc_data_structures:: sync:: { AtomicU32 , AtomicU64 , Lock , Lrc } ;
14
+ #[ cfg( debug_assertions) ]
15
+ use rustc_data_structures:: sync:: AtomicU64 ;
16
+ use rustc_data_structures:: sync:: { AtomicU32 , Lock , Lrc } ;
15
17
use rustc_data_structures:: unord:: UnordMap ;
16
18
use rustc_index:: IndexVec ;
17
19
use rustc_macros:: { Decodable , Encodable } ;
@@ -484,9 +486,8 @@ impl<D: Deps> DepGraph<D> {
484
486
} ;
485
487
let task_deps = & mut * task_deps;
486
488
487
- if cfg ! ( debug_assertions) {
488
- data. current . total_read_count . fetch_add ( 1 , Ordering :: Relaxed ) ;
489
- }
489
+ #[ cfg( debug_assertions) ]
490
+ data. current . total_read_count . fetch_add ( 1 , Ordering :: Relaxed ) ;
490
491
491
492
// As long as we only have a low number of reads we can avoid doing a hash
492
493
// insert and potentially allocating/reallocating the hashmap
@@ -514,7 +515,8 @@ impl<D: Deps> DepGraph<D> {
514
515
}
515
516
}
516
517
}
517
- } else if cfg ! ( debug_assertions) {
518
+ } else {
519
+ #[ cfg( debug_assertions) ]
518
520
data. current . total_duplicate_read_count . fetch_add ( 1 , Ordering :: Relaxed ) ;
519
521
}
520
522
} )
@@ -960,6 +962,7 @@ impl<D: Deps> DepGraph<D> {
960
962
}
961
963
}
962
964
965
+ #[ cfg( debug_assertions) ]
963
966
pub fn print_incremental_info ( & self ) {
964
967
if let Some ( data) = & self . data {
965
968
data. current . encoder . print_incremental_info (
@@ -1082,7 +1085,10 @@ pub(super) struct CurrentDepGraph<D: Deps> {
1082
1085
1083
1086
/// These are simple counters that are for profiling and
1084
1087
/// debugging and only active with `debug_assertions`.
1088
+ #[ cfg( debug_assertions) ]
1085
1089
total_read_count : AtomicU64 ,
1090
+
1091
+ #[ cfg( debug_assertions) ]
1086
1092
total_duplicate_read_count : AtomicU64 ,
1087
1093
}
1088
1094
@@ -1135,7 +1141,9 @@ impl<D: Deps> CurrentDepGraph<D> {
1135
1141
forbidden_edge,
1136
1142
#[ cfg( debug_assertions) ]
1137
1143
fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate) ) ,
1144
+ #[ cfg( debug_assertions) ]
1138
1145
total_read_count : AtomicU64 :: new ( 0 ) ,
1146
+ #[ cfg( debug_assertions) ]
1139
1147
total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
1140
1148
}
1141
1149
}
0 commit comments