Open adityabaradwaj opened 4 months ago
See here for related issue: https://github.com/serde-rs/serde/issues/2623. This is only reproducible within certain crate/workspace setups. Presumably some other dependencies are affecting serde's behavior
Update: my issue seems to controlled by the presence of a transitive dependency on the ethers
and ethers-contract
crates: https://github.com/serde-rs/serde/issues/2623#issuecomment-2133242549
Removing these dependencies results in correct behavior.
Still unclear what the underlying cause is though.
The issue is caused by the serde_json arbitrary_precision feature being turned on. It passes when this feature is off and fails when it is on.
that is the bug in the serde_json library
~Update: this example works on other people's systems, but fails on mine.~ ~My specs:~ ~- M1 Max Macbook Pro running macOS Sonoma 14.5~ ~- rustc 1.76.0~ ~Already tried after running
cargo clean
, same result.~Minimal reproducible example:
Expected output
The struct correctly serializes and deserializes back into the original, with no errors
Observed output
Notes
This only happens when the inner type contains a f64 or f32. String and integer types seem to ser/deser without an error. The error also goes away when I remove
#[serde(flatten)]