@@ -8,6 +8,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
88
99use rustc_data_structures:: fingerprint:: Fingerprint ;
1010use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
11+ use rustc_data_structures:: outline;
1112use rustc_data_structures:: profiling:: QueryInvocationId ;
1213use rustc_data_structures:: sharded:: { self , Sharded } ;
1314use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
@@ -651,8 +652,10 @@ impl<D: Deps> DepGraphData<D> {
651652 } else if let Some ( nodes_newly_allocated_in_current_session) =
652653 & self . current . nodes_newly_allocated_in_current_session
653654 {
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+ } ) ;
656659 }
657660 }
658661
@@ -1095,7 +1098,8 @@ pub(super) struct CurrentDepGraph<D: Deps> {
10951098 forbidden_edge : Option < EdgeFilter > ,
10961099
10971100 /// 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.
10991103 ///
11001104 /// The map contains all DepNodes that have been allocated in the current session so far and
11011105 /// for which there is no equivalent in the previous session.
@@ -1148,6 +1152,9 @@ impl<D: Deps> CurrentDepGraph<D> {
11481152
11491153 let new_node_count_estimate = 102 * prev_graph_node_count / 100 + 200 ;
11501154
1155+ let new_node_dbg =
1156+ session. opts . unstable_opts . incremental_verify_ich || cfg ! ( debug_assertions) ;
1157+
11511158 CurrentDepGraph {
11521159 encoder : GraphEncoder :: new (
11531160 encoder,
@@ -1169,16 +1176,12 @@ impl<D: Deps> CurrentDepGraph<D> {
11691176 forbidden_edge,
11701177 #[ cfg( debug_assertions) ]
11711178 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+ } ) ,
11821185 total_read_count : AtomicU64 :: new ( 0 ) ,
11831186 total_duplicate_read_count : AtomicU64 :: new ( 0 ) ,
11841187 }
@@ -1210,9 +1213,11 @@ impl<D: Deps> CurrentDepGraph<D> {
12101213 if let Some ( ref nodes_newly_allocated_in_current_session) =
12111214 self . nodes_newly_allocated_in_current_session
12121215 {
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+ } ) ;
12161221 }
12171222
12181223 dep_node_index
0 commit comments