ITADN

Incomplete serialization for zero-element tuple variant

#416Closedudoprog 创建于 2025-03-15
U
udoprogcommented
I found this will adding simd_json in udoprog/musli#270 This: ```rust use serde::{Serialize, Deserialize}; #[derive(Debug, Clone, PartialEq)] #[derive(Serialize, Deserialize)] pub enum FullEnum { EmptyTuple(), } fn main() { dbg!(simd_json::serde::to_string(&FullEnum::EmptyTuple())); } ```` Run this and you get: ``` [tests/examples/simd_json.rs:9:5] simd_json::serde::to_string(&FullEnum::EmptyTuple()) = Ok( "{\"EmptyTuple\":[]", ) ``` There is an additional error I have not yet been able to trace down (might be related) because the structure being generated is so big. I suspect it's related to this, since the `large` model includes a vector of enums (which might have the same instance above triggering the same issue): You can reproduce it by running this in [`musli`](github.com/udoprog/musli): ``` cargo run -p tests --features simd-json -- --iter 10 large simd_json/large: .E 0: error during decode: ExpectedObjectKey at character 96446 ('{') 0: failing structure written to target/musli/simd_json_large_0_0_error.bin 9.026322ms ```
关闭于 2025-03-18 1 条评论