Hi,
I'm trying to use serde_v8::Value
to pass through a v8::Local<v8::Value>
in a deserialized enum field like this:
pub enum SomeEnum<'s> {
A {
id: serde_v8::Value<'s>,
},
}
The value being deserialized to the id
field is a JS object with circular references inside, and serde_v8
gets stuck in an infinite recursion during deserialization.
Stack trace near the entry to from_v8
:
#72021 0x0000560ec8ffd0ee in <serde::__private::de::content::ContentVisitor as serde::de::Visitor>::visit_map (self=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:488
#72022 0x0000560ec90adc1b in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_map (self=<optimized out>, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:315
#72023 0x0000560ec90abb11 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec347aac0, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:134
#72024 0x0000560ec8ffccca in <serde::__private::de::content::Content as serde::de::Deserialize>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:297
#72025 0x0000560ec90ab50a in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#72026 0x0000560ec90a6c33 in <serde_v8::de::MapAccess as serde::de::MapAccess>::next_value_seed (self=<optimized out>, seed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:486
#72027 0x0000560ec8ff11ca in serde::de::MapAccess::next_value (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1846
#72028 0x0000560ec8fff926 in <serde::__private::de::content::TaggedContentVisitor<T> as serde::de::Visitor>::visit_map (self=..., map=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:881
#72029 0x0000560ec90ad411 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_map (self=<optimized out>, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:315
#72030 0x0000560ec90abde4 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec347ae48, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:134
#72031 0x0000560ec90d680c in rwv2::api::graphics::layout::_::<impl serde::de::Deserialize for rwv2::api::graphics::layout::Prop>::deserialize (__deserializer=0x0) at src/api/graphics/layout/mod.rs:91
#72032 0x0000560ec90ab2da in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#72033 0x0000560ec90aa031 in <serde_v8::de::ObjectAccess as serde::de::MapAccess>::next_value_seed (self=<optimized out>, seed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:548
#72034 0x0000560ec90a5bba in serde::de::MapAccess::next_value (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1846
#72035 0x0000560ec90b818b in <rwv2::api::graphics::layout::_::<impl serde::de::Deserialize for rwv2::api::graphics::layout::LayoutConstraint>::deserialize::__Visitor as serde::de::Visitor>::visit_map (self=..., __map=...) at src/api/graphics/layout/mod.rs:49
#72036 0x0000560ec90b30b7 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_struct (self=0x7ffec347b0c8, name=..., fields=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:383
#72037 0x0000560ec90d55b3 in rwv2::api::graphics::layout::_::<impl serde::de::Deserialize for rwv2::api::graphics::layout::LayoutConstraint>::deserialize (__deserializer=0x0) at src/api/graphics/layout/mod.rs:49
#72038 0x0000560ec90ab3aa in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#72039 0x0000560ec90a7376 in <serde_v8::de::SeqAccess as serde::de::SeqAccess>::next_element_seed (self=<optimized out>, seed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:593
#72040 0x0000560ec9058d4a in serde::de::SeqAccess::next_element (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1707
#72041 0x0000560ec90558d5 in <serde::de::impls::<impl serde::de::Deserialize for alloc::vec::Vec<T>>::deserialize::VecVisitor<T> as serde::de::Visitor>::visit_seq (self=..., seq=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/impls.r
s:928
#72042 0x0000560ec90ae810 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_seq (self=0x7ffec347b2c8, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:257
#72043 0x0000560ec8fd3b1a in serde::de::impls::<impl serde::de::Deserialize for alloc::vec::Vec<T>>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/impls.rs:939
#72044 0x0000560ec90ab4ba in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#72045 0x0000560ec90a9e71 in <serde_v8::de::ObjectAccess as serde::de::MapAccess>::next_value_seed (self=<optimized out>, seed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:548
#72046 0x0000560ec90a5baa in serde::de::MapAccess::next_value (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1846
#72047 0x0000560ec90b7d2e in <rwv2::api::graphics::layout::_::<impl serde::de::Deserialize for rwv2::api::graphics::layout::LayoutRequest>::deserialize::__Visitor as serde::de::Visitor>::visit_map (self=..., __map=...) at src/api/graphics/layout/mod.rs:16
#72048 0x0000560ec90b4937 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_struct (self=0x7ffec347b5d8, name=..., fields=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:383
#72049 0x0000560ec90d4d13 in rwv2::api::graphics::layout::_::<impl serde::de::Deserialize for rwv2::api::graphics::layout::LayoutRequest>::deserialize (__deserializer=0x0) at src/api/graphics/layout/mod.rs:16
#72050 0x0000560ec90b555e in serde_v8::de::from_v8 (scope=<optimized out>, input=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:43
#72051 0x0000560ec90cfc3b in rwv2::api::util::v8_deserialize (scope=0x0, value=...) at src/api/util.rs:18
And the repeating pattern is:
#71769 0x0000560ec8ffd673 in <serde::__private::de::content::ContentVisitor as serde::de::Visitor>::visit_seq (self=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:477
#71770 0x0000560ec90ae560 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_seq (self=0x7ffec3473878, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:257
#71771 0x0000560ec90abac3 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec3473878, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:133
#71772 0x0000560ec8ffccca in <serde::__private::de::content::Content as serde::de::Deserialize>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:297
#71773 0x0000560ec90ab50a in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#71774 0x0000560ec90a62d2 in <serde_v8::de::MapAccess as serde::de::MapAccess>::next_entry_seed (self=<optimized out>, kseed=..., vseed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:506
#71775 0x0000560ec8ff10da in serde::de::MapAccess::next_entry (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1860
#71776 0x0000560ec8ffd046 in <serde::__private::de::content::ContentVisitor as serde::de::Visitor>::visit_map (self=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:488
#71777 0x0000560ec90adc1b in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_map (self=<optimized out>, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:315
#71778 0x0000560ec90abb11 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec3473be8, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:134
#71779 0x0000560ec8ffccca in <serde::__private::de::content::Content as serde::de::Deserialize>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:297
#71780 0x0000560ec90ab50a in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#71781 0x0000560ec90a62d2 in <serde_v8::de::MapAccess as serde::de::MapAccess>::next_entry_seed (self=<optimized out>, kseed=..., vseed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:506
#71782 0x0000560ec8ff10da in serde::de::MapAccess::next_entry (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1860
#71783 0x0000560ec8ffd046 in <serde::__private::de::content::ContentVisitor as serde::de::Visitor>::visit_map (self=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:488
#71784 0x0000560ec90adc1b in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_map (self=<optimized out>, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:315
#71785 0x0000560ec90abb11 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec3473f58, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:134
#71786 0x0000560ec8ffccca in <serde::__private::de::content::Content as serde::de::Deserialize>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:297
#71787 0x0000560ec90ab50a in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#71788 0x0000560ec90a62d2 in <serde_v8::de::MapAccess as serde::de::MapAccess>::next_entry_seed (self=<optimized out>, kseed=..., vseed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:506
#71789 0x0000560ec8ff10da in serde::de::MapAccess::next_entry (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1860
#71790 0x0000560ec8ffd046 in <serde::__private::de::content::ContentVisitor as serde::de::Visitor>::visit_map (self=..., visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:488
#71791 0x0000560ec90adc1b in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_map (self=<optimized out>, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:315
#71792 0x0000560ec90abb11 in <&mut serde_v8::de::Deserializer as serde::de::Deserializer>::deserialize_any (self=0x7ffec3474228, visitor=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:134
#71793 0x0000560ec8ffccca in <serde::__private::de::content::Content as serde::de::Deserialize>::deserialize (deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/private/de.rs:297
#71794 0x0000560ec90ab50a in <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize (self=..., deserializer=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:785
#71795 0x0000560ec90a7756 in <serde_v8::de::SeqAccess as serde::de::SeqAccess>::next_element_seed (self=<optimized out>, seed=...) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_v8-0.11.0/src/de.rs:593
#71796 0x0000560ec8ff1b1a in serde::de::SeqAccess::next_element (self=0x0) at /home/zhy/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.130/src/de/mod.rs:1707