-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
I'm getting out of range integral type conversion attempted errors when the deserializer sees numbers with more than 16 digits.
Updating the value::tests:number test in this way exposes the issue:
diff --git a/pbjson-types/src/value.rs b/pbjson-types/src/value.rs
index c3fc87b..14d9fc2 100644
--- a/pbjson-types/src/value.rs
+++ b/pbjson-types/src/value.rs
@@ -321,6 +321,8 @@ mod tests {
serde_json::to_value(Value::from(5.0)).unwrap(),
serde_json::json!(5.0)
);
+ let val: Value = serde_json::from_str("13241173089000000").unwrap();
+ assert_eq!(val, Value::from(13241173089000000f64))
}
#[test]That test addition results in:
---- value::tests::number stdout ----
thread 'value::tests::number' panicked at pbjson-types/src/value.rs:324:68:
called `Result::unwrap()` on an `Err` value: Error("out of range integral type conversion attempted", line: 1, column: 17)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I understand there was a related fix (#87) last year. However, this fails with larger numbers which are still well within the min/max range for floating numbers in Rust, as the number in the above test modification.
Metadata
Metadata
Assignees
Labels
No labels