@@ -8,6 +8,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
8
8
9
9
use rustc_data_structures:: fingerprint:: { Fingerprint , PackedFingerprint } ;
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 } ;
@@ -675,8 +676,10 @@ impl<D: Deps> DepGraphData<D> {
675
676
} else if let Some ( nodes_newly_allocated_in_current_session) =
676
677
& self . current . nodes_newly_allocated_in_current_session
677
678
{
678
- let seen = nodes_newly_allocated_in_current_session. lock ( ) . contains ( dep_node) ;
679
- assert ! ( !seen, "{}" , msg( ) ) ;
679
+ outline ( || {
680
+ let seen = nodes_newly_allocated_in_current_session. lock ( ) . contains ( dep_node) ;
681
+ assert ! ( !seen, "{}" , msg( ) ) ;
682
+ } ) ;
680
683
}
681
684
}
682
685
@@ -1133,7 +1136,8 @@ pub(super) struct CurrentDepGraph<D: Deps> {
1133
1136
forbidden_edge : Option < EdgeFilter > ,
1134
1137
1135
1138
/// Used to verify the absence of hash collisions among DepNodes.
1136
- /// This field is only `Some` if the `-Z incremental_verify_ich` option is present.
1139
+ /// This field is only `Some` if the `-Z incremental_verify_ich` option is present
1140
+ /// or if `debug_assertions` are enabled.
1137
1141
///
1138
1142
/// The map contains all DepNodes that have been allocated in the current session so far and
1139
1143
/// for which there is no equivalent in the previous session.
@@ -1186,6 +1190,9 @@ impl<D: Deps> CurrentDepGraph<D> {
1186
1190
1187
1191
let new_node_count_estimate = 102 * prev_graph_node_count / 100 + 200 ;
1188
1192
1193
+ let new_node_dbg =
1194
+ session. opts . unstable_opts . incremental_verify_ich || cfg ! ( debug_assertions) ;
1195
+
1189
1196
CurrentDepGraph {
1190
1197
encoder : GraphEncoder :: new (
1191
1198
encoder,
@@ -1207,16 +1214,12 @@ impl<D: Deps> CurrentDepGraph<D> {
1207
1214
forbidden_edge,
1208
1215
#[ cfg( debug_assertions) ]
1209
1216
fingerprints : Lock :: new ( IndexVec :: from_elem_n ( None , new_node_count_estimate) ) ,
1210
- nodes_newly_allocated_in_current_session : session
1211
- . opts
1212
- . unstable_opts
1213
- . incremental_verify_ich
1214
- . then ( || {
1215
- Lock :: new ( FxHashSet :: with_capacity_and_hasher (
1216
- new_node_count_estimate,
1217
- Default :: default ( ) ,
1218
- ) )
1219
- } ) ,
1217
+ nodes_newly_allocated_in_current_session : new_node_dbg. then ( || {
1218
+ Lock :: new ( FxHashSet :: with_capacity_and_hasher (
1219
+ new_node_count_estimate,
1220
+ Default :: default ( ) ,
1221
+ ) )
1222
+ } ) ,
1220
1223
total_read_count : AtomicU64 :: new ( 0 ) ,
1221
1224
total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
1222
1225
}
@@ -1248,9 +1251,11 @@ impl<D: Deps> CurrentDepGraph<D> {
1248
1251
if let Some ( ref nodes_newly_allocated_in_current_session) =
1249
1252
self . nodes_newly_allocated_in_current_session
1250
1253
{
1251
- if !nodes_newly_allocated_in_current_session. lock ( ) . insert ( key) {
1252
- panic ! ( "Found duplicate dep-node {key:?}" ) ;
1253
- }
1254
+ outline ( || {
1255
+ if !nodes_newly_allocated_in_current_session. lock ( ) . insert ( key) {
1256
+ panic ! ( "Found duplicate dep-node {key:?}" ) ;
1257
+ }
1258
+ } ) ;
1254
1259
}
1255
1260
1256
1261
dep_node_index
0 commit comments