@@ -8,6 +8,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
8
8
9
9
use rustc_data_structures:: fingerprint:: Fingerprint ;
10
10
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
11
+ use rustc_data_structures:: outline;
11
12
use rustc_data_structures:: profiling:: QueryInvocationId ;
12
13
use rustc_data_structures:: sharded:: { self , Sharded } ;
13
14
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
@@ -651,8 +652,10 @@ impl<D: Deps> DepGraphData<D> {
651
652
} else if let Some ( nodes_newly_allocated_in_current_session) =
652
653
& self . current . nodes_newly_allocated_in_current_session
653
654
{
654
- let seen = nodes_newly_allocated_in_current_session. lock ( ) . contains ( dep_node) ;
655
- assert ! ( !seen, "{}" , msg( ) ) ;
655
+ outline ( || {
656
+ let seen = nodes_newly_allocated_in_current_session. lock ( ) . contains ( dep_node) ;
657
+ assert ! ( !seen, "{}" , msg( ) ) ;
658
+ } ) ;
656
659
}
657
660
}
658
661
@@ -1095,7 +1098,8 @@ pub(super) struct CurrentDepGraph<D: Deps> {
1095
1098
forbidden_edge : Option < EdgeFilter > ,
1096
1099
1097
1100
/// Used to verify the absence of hash collisions among DepNodes.
1098
- /// This field is only `Some` if the `-Z incremental_verify_ich` option is present.
1101
+ /// This field is only `Some` if the `-Z incremental_verify_ich` option is present
1102
+ /// or if `debug_assertions` are enabled.
1099
1103
///
1100
1104
/// The map contains all DepNodes that have been allocated in the current session so far and
1101
1105
/// for which there is no equivalent in the previous session.
@@ -1148,6 +1152,9 @@ impl<D: Deps> CurrentDepGraph<D> {
1148
1152
1149
1153
let new_node_count_estimate = 102 * prev_graph_node_count / 100 + 200 ;
1150
1154
1155
+ let new_node_dbg =
1156
+ session. opts . unstable_opts . incremental_verify_ich || cfg ! ( debug_assertions) ;
1157
+
1151
1158
CurrentDepGraph {
1152
1159
encoder : GraphEncoder :: new (
1153
1160
encoder,
@@ -1169,16 +1176,12 @@ impl<D: Deps> CurrentDepGraph<D> {
1169
1176
forbidden_edge,
1170
1177
#[ cfg( debug_assertions) ]
1171
1178
fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate) ) ,
1172
- nodes_newly_allocated_in_current_session : session
1173
- . opts
1174
- . unstable_opts
1175
- . incremental_verify_ich
1176
- . then ( || {
1177
- Lock :: new ( FxHashSet :: with_capacity_and_hasher (
1178
- new_node_count_estimate,
1179
- Default :: default ( ) ,
1180
- ) )
1181
- } ) ,
1179
+ nodes_newly_allocated_in_current_session : new_node_dbg. then ( || {
1180
+ Lock :: new ( FxHashSet :: with_capacity_and_hasher (
1181
+ new_node_count_estimate,
1182
+ Default :: default ( ) ,
1183
+ ) )
1184
+ } ) ,
1182
1185
total_read_count : AtomicU64 :: new ( 0 ) ,
1183
1186
total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
1184
1187
}
@@ -1210,9 +1213,11 @@ impl<D: Deps> CurrentDepGraph<D> {
1210
1213
if let Some ( ref nodes_newly_allocated_in_current_session) =
1211
1214
self . nodes_newly_allocated_in_current_session
1212
1215
{
1213
- if !nodes_newly_allocated_in_current_session. lock ( ) . insert ( key) {
1214
- panic ! ( "Found duplicate dep-node {key:?}" ) ;
1215
- }
1216
+ outline ( || {
1217
+ if !nodes_newly_allocated_in_current_session. lock ( ) . insert ( key) {
1218
+ panic ! ( "Found duplicate dep-node {key:?}" ) ;
1219
+ }
1220
+ } ) ;
1216
1221
}
1217
1222
1218
1223
dep_node_index
0 commit comments