aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-20 22:25:27 +0100
committerGitHub <[email protected]>2021-04-20 22:25:27 +0100
commit70fe7a4515ebdc6222a6565cd4cd1c5fd0c77350 (patch)
treeecc5755941360a672c5ef1f6a040fb9f03c4b7d7
parentad131049c4cd1302af1a5616ff83d0e1f0cadea2 (diff)
parentcdfe5a8be01dd7427db734f17c5ec0de7bbe6c80 (diff)
Merge #8606
8606: fix: no more Registering progress handler for token rustAnalyzer/Ind… r=jonas-schievink a=matklad …exing failed. closes #8509 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ide/src/prime_caches.rs3
-rw-r--r--crates/stdx/src/lib.rs12
2 files changed, 13 insertions, 2 deletions
diff --git a/crates/ide/src/prime_caches.rs b/crates/ide/src/prime_caches.rs
index ea0acfaa0..03597f507 100644
--- a/crates/ide/src/prime_caches.rs
+++ b/crates/ide/src/prime_caches.rs
@@ -27,6 +27,7 @@ pub(crate) fn prime_caches(db: &RootDatabase, cb: &(dyn Fn(PrimeCachesProgress)
27 let topo = &graph.crates_in_topological_order(); 27 let topo = &graph.crates_in_topological_order();
28 28
29 cb(PrimeCachesProgress::Started); 29 cb(PrimeCachesProgress::Started);
30 let _d = stdx::defer(|| cb(PrimeCachesProgress::Finished));
30 31
31 // FIXME: This would be easy to parallelize, since it's in the ideal ordering for that. 32 // FIXME: This would be easy to parallelize, since it's in the ideal ordering for that.
32 // Unfortunately rayon prevents panics from propagation out of a `scope`, which breaks 33 // Unfortunately rayon prevents panics from propagation out of a `scope`, which breaks
@@ -41,6 +42,4 @@ pub(crate) fn prime_caches(db: &RootDatabase, cb: &(dyn Fn(PrimeCachesProgress)
41 }); 42 });
42 db.crate_def_map(*krate); 43 db.crate_def_map(*krate);
43 } 44 }
44
45 cb(PrimeCachesProgress::Finished);
46} 45}
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs
index e3eb10915..857567a85 100644
--- a/crates/stdx/src/lib.rs
+++ b/crates/stdx/src/lib.rs
@@ -179,6 +179,18 @@ where
179 start..start + len 179 start..start + len
180} 180}
181 181
182pub fn defer<F: FnOnce()>(f: F) -> impl Drop {
183 struct D<F: FnOnce()>(Option<F>);
184 impl<F: FnOnce()> Drop for D<F> {
185 fn drop(&mut self) {
186 if let Some(f) = self.0.take() {
187 f()
188 }
189 }
190 }
191 D(Some(f))
192}
193
182#[repr(transparent)] 194#[repr(transparent)]
183pub struct JodChild(pub std::process::Child); 195pub struct JodChild(pub std::process::Child);
184 196