aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api/src/msg.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2021-01-01 07:09:27 +0000
committerEdwin Cheng <[email protected]>2021-01-01 07:09:27 +0000
commita65025604da0a3f43b668c60a4a2f97a70b71363 (patch)
tree4c6af6d0b9ab4fa148b05c70e8f15aa9699ab229 /crates/proc_macro_api/src/msg.rs
parenta9814fa9c037b0fafd30580a6e7682ed032d77e6 (diff)
Fix deep syntax tree bug generated by proc-macro
Diffstat (limited to 'crates/proc_macro_api/src/msg.rs')
-rw-r--r--crates/proc_macro_api/src/msg.rs9
1 files changed, 8 insertions, 1 deletions
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<()> {