Skip to content

Commit 2cd159d

Browse files
committedMar 13, 2024
Address comments
1 parent e72a99a commit 2cd159d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎compiler/rustc_query_system/src/dep_graph/serialized.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ impl SerializedDepGraph {
204204
.map(|&n| UnhashMap::with_capacity_and_hasher(n, Default::default()))
205205
.collect();
206206

207+
// Use a single loop to build indices for all kinds, unlike `setup_index` which builds
208+
// a single index for each loop over the nodes.
207209
for (idx, node) in self.nodes.iter_enumerated() {
208210
index[node.kind.as_usize()].insert(node.hash, idx);
209211
}
@@ -220,7 +222,9 @@ impl SerializedDepGraph {
220222
let client = jobserver::client();
221223
// This should ideally use `try_acquire` to avoid races on the tokens,
222224
// but the jobserver crate doesn't support that operation.
223-
if let Ok(true) = client.available().map(|tokens| tokens > 0) {
225+
if let Ok(tokens) = client.available()
226+
&& tokens > 0
227+
{
224228
let this = self.clone();
225229
thread::spawn(move || {
226230
let _token = client.acquire();

0 commit comments

Comments
 (0)