Skip to content

Commit f3dde45

Browse files
committed
Enable debugging the dep-graph without debug-assertions.
It may also be useful in these cases, and some CI configurations test without debug assertions.
1 parent 8ee9322 commit f3dde45

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

compiler/rustc_query_system/src/dep_graph/serialized.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,19 @@ impl<K: DepKind> EncoderState<K> {
157157
}
158158
}
159159

160-
#[instrument(skip(self, _record_graph))]
160+
#[instrument(skip(self, record_graph))]
161161
fn encode_node(
162162
&mut self,
163163
node: &NodeInfo<K>,
164-
_record_graph: &Option<Lock<DepGraphQuery<K>>>,
164+
record_graph: &Option<Lock<DepGraphQuery<K>>>,
165165
) -> DepNodeIndex {
166166
let index = DepNodeIndex::new(self.total_node_count);
167167
self.total_node_count += 1;
168168

169169
let edge_count = node.edges.len();
170170
self.total_edge_count += edge_count;
171171

172-
#[cfg(debug_assertions)]
173-
if let Some(record_graph) = &_record_graph {
172+
if let Some(record_graph) = &record_graph {
174173
// Do not ICE when a query is called from within `with_query`.
175174
if let Some(record_graph) = &mut record_graph.try_lock() {
176175
record_graph.push(index, node.node, &node.edges);
@@ -222,11 +221,8 @@ impl<K: DepKind + Encodable<FileEncoder>> GraphEncoder<K> {
222221
record_graph: bool,
223222
record_stats: bool,
224223
) -> Self {
225-
let record_graph = if cfg!(debug_assertions) && record_graph {
226-
Some(Lock::new(DepGraphQuery::new(prev_node_count)))
227-
} else {
228-
None
229-
};
224+
let record_graph =
225+
if record_graph { Some(Lock::new(DepGraphQuery::new(prev_node_count))) } else { None };
230226
let status = Lock::new(EncoderState::new(encoder, record_stats));
231227
GraphEncoder { status, record_graph }
232228
}

0 commit comments

Comments
 (0)