about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2021-05-01 17:53:34 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2021-05-01 20:13:18 -0400
commit61fd56fdb97607318f6d7ed53e73d63d1bbc8ad4 (patch)
treec416be0a1b6a5d186ef2c3337ed93c8051fe0005
parent1c2c6b670023efda0fea8e1837f9542d3ed12f5d (diff)
downloadrust-61fd56fdb97607318f6d7ed53e73d63d1bbc8ad4.tar.gz
rust-61fd56fdb97607318f6d7ed53e73d63d1bbc8ad4.zip
Avoid generating QueryMap::extend for each key type
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index f7b83812e89..c9125b3ffe9 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -125,18 +125,15 @@ where
         // We use try_lock_shards here since we are called from the
         // deadlock handler, and this shouldn't be locked.
         let shards = self.shards.try_lock_shards()?;
-        let shards = shards.iter().enumerate();
-        jobs.extend(shards.flat_map(|(shard_id, shard)| {
-            shard.active.iter().filter_map(move |(k, v)| {
+        for (shard_id, shard) in shards.iter().enumerate() {
+            for (k, v) in shard.active.iter() {
                 if let QueryResult::Started(ref job) = *v {
                     let id = QueryJobId::new(job.id, shard_id, kind);
                     let info = QueryInfo { span: job.span, query: make_query(tcx, k.clone()) };
-                    Some((id, QueryJobInfo { info, job: job.clone() }))
-                } else {
-                    None
+                    jobs.insert(id, QueryJobInfo { info, job: job.clone() });
                 }
-            })
-        }));
+            }
+        }
 
         Some(())
     }