about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-02 09:22:13 +0000
committerbors <bors@rust-lang.org>2021-05-02 09:22:13 +0000
commit3a1cd0ed368ea98fc67e8688dba5982a6aae62e0 (patch)
treeb36a4f52cc3fa0a8ba535c454dff80e134cbfe89
parent6d4e3c1ed61ace03ba5d9ee9e4bfa87c1f586efe (diff)
parent61fd56fdb97607318f6d7ed53e73d63d1bbc8ad4 (diff)
downloadrust-3a1cd0ed368ea98fc67e8688dba5982a6aae62e0.tar.gz
rust-3a1cd0ed368ea98fc67e8688dba5982a6aae62e0.zip
Auto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot
Avoid generating QueryMap::extend for each key type

Should be a small win on compile times for rustc_query_impl, where this ends up getting codegen'd.
-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(())
     }