remove expand from pool

This commit is contained in:
bit-aloo 2026-01-04 05:50:16 +05:30
parent 19a2994d8e
commit 06452610d7
No known key found for this signature in database
2 changed files with 2 additions and 31 deletions

View File

@ -254,7 +254,7 @@ impl ProcMacro {
}
}
self.pool.expand(
self.pool.pick_process()?.expand(
self,
subtree,
attr,

View File

@ -1,8 +1,6 @@
//! A pool of proc-macro server processes
use std::sync::Arc;
use tt::Span;
use crate::{
MacroDylib, ProcMacro, ServerError, bidirectional_protocol::SubCallback,
process::ProcMacroServerProcess,
@ -29,7 +27,7 @@ impl ProcMacroServerPool {
self.workers[0].exited()
}
fn pick_process(&self) -> Result<&ProcMacroServerProcess, ServerError> {
pub(crate) fn pick_process(&self) -> Result<&ProcMacroServerProcess, ServerError> {
self.workers
.iter()
.filter(|w| w.exited().is_none())
@ -75,33 +73,6 @@ impl ProcMacroServerPool {
.collect())
}
pub(crate) fn expand(
&self,
proc_macro: &ProcMacro,
subtree: tt::SubtreeView<'_>,
attr: Option<tt::SubtreeView<'_>>,
env: Vec<(String, String)>,
def_site: Span,
call_site: Span,
mixed_site: Span,
current_dir: String,
callback: Option<SubCallback<'_>>,
) -> Result<Result<tt::TopSubtree, String>, ServerError> {
let process = self.pick_process()?;
process.expand(
proc_macro,
subtree,
attr,
env,
def_site,
call_site,
mixed_site,
current_dir,
callback,
)
}
pub(crate) fn version(&self) -> u32 {
self.version
}