diff options
Diffstat (limited to 'crates/proc_macro_api')
-rw-r--r-- | crates/proc_macro_api/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/proc_macro_api/src/msg.rs | 9 | ||||
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 7 |
3 files changed, 13 insertions, 4 deletions
diff --git a/crates/proc_macro_api/Cargo.toml b/crates/proc_macro_api/Cargo.toml index 1af2bbca7..a8e128d55 100644 --- a/crates/proc_macro_api/Cargo.toml +++ b/crates/proc_macro_api/Cargo.toml | |||
@@ -12,6 +12,7 @@ doctest = false | |||
12 | [dependencies] | 12 | [dependencies] |
13 | serde = { version = "1.0", features = ["derive"] } | 13 | serde = { version = "1.0", features = ["derive"] } |
14 | serde_json = "1.0" | 14 | serde_json = "1.0" |
15 | serde_stacker = "0.1" | ||
15 | log = "0.4.8" | 16 | log = "0.4.8" |
16 | crossbeam-channel = "0.5.0" | 17 | crossbeam-channel = "0.5.0" |
17 | jod-thread = "0.1.1" | 18 | jod-thread = "0.1.1" |
diff --git a/crates/proc_macro_api/src/msg.rs b/crates/proc_macro_api/src/msg.rs index f84ebdbc5..43d13a764 100644 --- a/crates/proc_macro_api/src/msg.rs +++ b/crates/proc_macro_api/src/msg.rs | |||
@@ -58,7 +58,14 @@ pub trait Message: Serialize + DeserializeOwned { | |||
58 | fn read(inp: &mut impl BufRead) -> io::Result<Option<Self>> { | 58 | fn read(inp: &mut impl BufRead) -> io::Result<Option<Self>> { |
59 | Ok(match read_json(inp)? { | 59 | Ok(match read_json(inp)? { |
60 | None => None, | 60 | None => None, |
61 | Some(text) => Some(serde_json::from_str(&text)?), | 61 | Some(text) => { |
62 | let mut deserializer = serde_json::Deserializer::from_str(&text); | ||
63 | // Note that some proc-macro generate very deep syntax tree | ||
64 | // We have to disable the current limit of serde here | ||
65 | deserializer.disable_recursion_limit(); | ||
66 | let deserializer = serde_stacker::Deserializer::new(&mut deserializer); | ||
67 | Some(Self::deserialize(deserializer)?) | ||
68 | } | ||
62 | }) | 69 | }) |
63 | } | 70 | } |
64 | fn write(self, out: &mut impl Write) -> io::Result<()> { | 71 | 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 d68723ada..6d6ab8888 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<Task>, mut process: Process) { | |||
92 | for Task { req, result_tx } in task_rx { | 92 | for Task { req, result_tx } in task_rx { |
93 | match send_request(&mut stdin, &mut stdout, req) { | 93 | match send_request(&mut stdin, &mut stdout, req) { |
94 | Ok(res) => result_tx.send(res).unwrap(), | 94 | Ok(res) => result_tx.send(res).unwrap(), |
95 | Err(_err) => { | 95 | Err(err) => { |
96 | log::error!( | 96 | log::error!( |
97 | "proc macro server crashed, server process state: {:?}", | 97 | "proc macro server crashed, server process state: {:?}, server request error: {:?}", |
98 | process.child.try_wait() | 98 | process.child.try_wait(), |
99 | err | ||
99 | ); | 100 | ); |
100 | let res = Response::Error(ResponseError { | 101 | let res = Response::Error(ResponseError { |
101 | code: ErrorCode::ServerErrorEnd, | 102 | code: ErrorCode::ServerErrorEnd, |