Skip to content

Commit afe4c16

Browse files
committed
Split the if to release the lock earlier
1 parent dfae9c9 commit afe4c16

File tree

1 file changed

+14
-9
lines changed
  • compiler/rustc_query_system/src/dep_graph

1 file changed

+14
-9
lines changed

compiler/rustc_query_system/src/dep_graph/graph.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -535,17 +535,22 @@ impl<K: DepKind> DepGraph<K> {
535535
// value to an existing node.
536536
//
537537
// For sanity, we still check that the loaded stable hash and the new one match.
538-
if let Some(prev_index) = data.previous.node_to_index_opt(&node)
539-
&& let Some(dep_node_index) = { data.current.prev_index_to_index.lock()[prev_index] }
540-
{
541-
crate::query::incremental_verify_ich(cx, data, result, prev_index, hash_result);
538+
if let Some(prev_index) = data.previous.node_to_index_opt(&node) {
539+
let dep_node_index = data.current.prev_index_to_index.lock()[prev_index];
540+
if let Some(dep_node_index) = dep_node_index {
541+
crate::query::incremental_verify_ich(cx, data, result, prev_index, hash_result);
542542

543-
#[cfg(debug_assertions)]
544-
if hash_result.is_some() {
545-
data.current.record_edge(dep_node_index, node, data.prev_fingerprint_of(prev_index));
546-
}
543+
#[cfg(debug_assertions)]
544+
if hash_result.is_some() {
545+
data.current.record_edge(
546+
dep_node_index,
547+
node,
548+
data.prev_fingerprint_of(prev_index),
549+
);
550+
}
547551

548-
return dep_node_index;
552+
return dep_node_index;
553+
}
549554
}
550555

551556
let mut edges = SmallVec::new();

0 commit comments

Comments
 (0)