Skip to content

Commit 968baf7

Browse files
committed
Revert "Don't hold the active queries lock while calling make_query"
This reverts commit fd3d2d4. This has the side effect, that when Clippy should ICE (during an EarlyPass?) it will fill up the RAM with 2 GB/s and then freezes the PC. I don't know the correct solution, but this is blocking the Clippy sync and might give some people really bad experiences, so this should be reverted ASAP.
1 parent 2304917 commit 968baf7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

compiler/rustc_query_system/src/query/plumbing.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ where
6969
make_query: fn(Qcx, K) -> QueryStackFrame<D>,
7070
jobs: &mut QueryMap<D>,
7171
) -> Option<()> {
72-
let mut active = Vec::new();
73-
7472
#[cfg(parallel_compiler)]
7573
{
7674
// We use try_lock_shards here since we are called from the
@@ -79,7 +77,8 @@ where
7977
for shard in shards.iter() {
8078
for (k, v) in shard.iter() {
8179
if let QueryResult::Started(ref job) = *v {
82-
active.push((*k, job.clone()));
80+
let query = make_query(qcx, *k);
81+
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
8382
}
8483
}
8584
}
@@ -92,18 +91,12 @@ where
9291
// really hurt much.)
9392
for (k, v) in self.active.try_lock()?.iter() {
9493
if let QueryResult::Started(ref job) = *v {
95-
active.push((*k, job.clone()));
94+
let query = make_query(qcx, *k);
95+
jobs.insert(job.id, QueryJobInfo { query, job: job.clone() });
9696
}
9797
}
9898
}
9999

100-
// Call `make_query` while we're not holding a `self.active` lock as `make_query` may call
101-
// queries leading to a deadlock.
102-
for (key, job) in active {
103-
let query = make_query(qcx, key);
104-
jobs.insert(job.id, QueryJobInfo { query, job });
105-
}
106-
107100
Some(())
108101
}
109102
}

0 commit comments

Comments
 (0)