diff --git a/crates/proc_macro_api/src/msg.rs b/crates/proc_macro_api/src/msg.rs index f84ebdbc57..4cd5721016 100644 --- a/crates/proc_macro_api/src/msg.rs +++ b/crates/proc_macro_api/src/msg.rs @@ -58,7 +58,13 @@ pub trait Message: Serialize + DeserializeOwned { fn read(inp: &mut impl BufRead) -> io::Result> { Ok(match read_json(inp)? { None => None, - Some(text) => Some(serde_json::from_str(&text)?), + Some(text) => { + let mut deserializer = serde_json::Deserializer::from_str(&text); + // Note that some proc-macro generate very deep syntax tree + // We have to disable the current limit of serde here + deserializer.disable_recursion_limit(); + Some(Self::deserialize(&mut deserializer)?) + } }) } fn write(self, out: &mut impl Write) -> io::Result<()> { diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index d68723ada3..6d6ab88886 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs @@ -92,10 +92,11 @@ fn client_loop(task_rx: Receiver, mut process: Process) { for Task { req, result_tx } in task_rx { match send_request(&mut stdin, &mut stdout, req) { Ok(res) => result_tx.send(res).unwrap(), - Err(_err) => { + Err(err) => { log::error!( - "proc macro server crashed, server process state: {:?}", - process.child.try_wait() + "proc macro server crashed, server process state: {:?}, server request error: {:?}", + process.child.try_wait(), + err ); let res = Response::Error(ResponseError { code: ErrorCode::ServerErrorEnd,