mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 18:26:19 +00:00
Cleanup cfg check handling in expression store lowering
This commit is contained in:
parent
7d9b839f9c
commit
d11dbf648f
17 changed files with 234 additions and 188 deletions
|
|
@ -26,12 +26,12 @@ pub use pool::Pool;
|
|||
/// # Panics
|
||||
///
|
||||
/// Panics if failed to spawn the thread.
|
||||
pub fn spawn<F, T>(intent: ThreadIntent, f: F) -> JoinHandle<T>
|
||||
pub fn spawn<F, T>(intent: ThreadIntent, name: String, f: F) -> JoinHandle<T>
|
||||
where
|
||||
F: (FnOnce() -> T) + Send + 'static,
|
||||
T: Send + 'static,
|
||||
{
|
||||
Builder::new(intent).spawn(f).expect("failed to spawn thread")
|
||||
Builder::new(intent, name).spawn(f).expect("failed to spawn thread")
|
||||
}
|
||||
|
||||
pub struct Builder {
|
||||
|
|
@ -42,13 +42,8 @@ pub struct Builder {
|
|||
|
||||
impl Builder {
|
||||
#[must_use]
|
||||
pub fn new(intent: ThreadIntent) -> Self {
|
||||
Self { intent, inner: jod_thread::Builder::new(), allow_leak: false }
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn name(self, name: String) -> Self {
|
||||
Self { inner: self.inner.name(name), ..self }
|
||||
pub fn new(intent: ThreadIntent, name: impl Into<String>) -> Self {
|
||||
Self { intent, inner: jod_thread::Builder::new().name(name.into()), allow_leak: false }
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
|
|
|||
|
|
@ -50,10 +50,9 @@ impl Pool {
|
|||
let extant_tasks = Arc::new(AtomicUsize::new(0));
|
||||
|
||||
let mut handles = Vec::with_capacity(threads);
|
||||
for _ in 0..threads {
|
||||
let handle = Builder::new(INITIAL_INTENT)
|
||||
for idx in 0..threads {
|
||||
let handle = Builder::new(INITIAL_INTENT, format!("Worker{idx}",))
|
||||
.stack_size(STACK_SIZE)
|
||||
.name("Worker".into())
|
||||
.allow_leak(true)
|
||||
.spawn({
|
||||
let extant_tasks = Arc::clone(&extant_tasks);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue