mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
fix: no more Registering progress handler for token rustAnalyzer/Indexing failed.
This commit is contained in:
parent
ad131049c4
commit
cdfe5a8be0
2 changed files with 13 additions and 2 deletions
|
@ -27,6 +27,7 @@ pub(crate) fn prime_caches(db: &RootDatabase, cb: &(dyn Fn(PrimeCachesProgress)
|
||||||
let topo = &graph.crates_in_topological_order();
|
let topo = &graph.crates_in_topological_order();
|
||||||
|
|
||||||
cb(PrimeCachesProgress::Started);
|
cb(PrimeCachesProgress::Started);
|
||||||
|
let _d = stdx::defer(|| cb(PrimeCachesProgress::Finished));
|
||||||
|
|
||||||
// FIXME: This would be easy to parallelize, since it's in the ideal ordering for that.
|
// FIXME: This would be easy to parallelize, since it's in the ideal ordering for that.
|
||||||
// Unfortunately rayon prevents panics from propagation out of a `scope`, which breaks
|
// 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)
|
||||||
});
|
});
|
||||||
db.crate_def_map(*krate);
|
db.crate_def_map(*krate);
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(PrimeCachesProgress::Finished);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,18 @@ where
|
||||||
start..start + len
|
start..start + len
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn defer<F: FnOnce()>(f: F) -> impl Drop {
|
||||||
|
struct D<F: FnOnce()>(Option<F>);
|
||||||
|
impl<F: FnOnce()> Drop for D<F> {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Some(f) = self.0.take() {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
D(Some(f))
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct JodChild(pub std::process::Child);
|
pub struct JodChild(pub std::process::Child);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue