Repository navigation
arbitrary_precision: keep the sign of -0 - #1346
Merged
Merged
Conversation
Without `arbitrary_precision` the integer literal `-0` deserializes to the float -0.0, so a `Value` keeps the sign. With the feature, `parse_any_number` turned every integer that fits an i64 into `ParserNumber::I64` (d541381), and `"-0".parse::<i64>()` is 0, so the sign was lost: from_str::<Value>("-0")? Number(0) (should be -0) to_string(&from_str::<Value>("[-0]")?) "[0]" from_value::<f64>(from_str("-0")?) 0.0 (from_str::<f64> gives -0.0) `-0` now stays in the textual representation, so it is written back as `-0` and converts to -0.0, matching the behaviour without the feature and `test_parse_negative_zero`. Test: `test_negative_zero_value` (fails before this change with `--features arbitrary_precision`). Suite passes with no features, arbitrary_precision, +raw_value, +preserve_order,float_roundtrip, and raw_value,preserve_order. Found by a differential fuzzer (serde_json, simd-json, sonic-rs, jiter).
dadezzz
pushed a commit
to dadezzz/kube-dns-rs
that referenced
this pull request
Oct 12, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [serde_json](https://github.com/serde-rs/json) | dependencies | patch | `1.0.151` → `1.0.152` | --- ### Release Notes <details> <summary>serde-rs/json (serde_json)</summary> ### [`v1.0.152`](https://github.com/serde-rs/json/releases/tag/v1.0.152) [Compare Source](serde-rs/json@v1.0.151...v1.0.152) - Preserve sign of `-0` in arbitrary_precision mode ([#​1346](serde-rs/json#1346), thanks [@​yuxi-liu-wired](https://github.com/yuxi-liu-wired)) - Fix comparison of large non-integer values with f32::INFINITY ([#​1347](serde-rs/json#1347), thanks [@​yuxi-liu-wired](https://github.com/yuxi-liu-wired)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNDkuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjE0OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
github-actions Bot
pushed a commit
to modify-dev/harbor
that referenced
this pull request
Oct 20, 2026
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [serde_json](https://github.com/serde-rs/json) | dependencies | patch | `1.0.151` → `1.0.154` | --- >⚠️ **Warning** > > Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information. --- ### Release Notes <details> <summary>serde-rs/json (serde_json)</summary> ### [`v1.0.154`](https://github.com/serde-rs/json/releases/tag/v1.0.154) [Compare Source](serde-rs/json@v1.0.153...v1.0.154) - Support preserve_order in no_std builds ([#​1333](serde-rs/json#1333), thanks [@​razmser](https://github.com/razmser)) ### [`v1.0.153`](https://github.com/serde-rs/json/releases/tag/v1.0.153) [Compare Source](serde-rs/json@v1.0.152...v1.0.153) - Report invalid UTF-8 at the first bad byte ([#​1345](serde-rs/json#1345), thanks [@​00200200](https://github.com/00200200)) ### [`v1.0.152`](https://github.com/serde-rs/json/releases/tag/v1.0.152) [Compare Source](serde-rs/json@v1.0.151...v1.0.152) - Preserve sign of `-0` in arbitrary_precision mode ([#​1346](serde-rs/json#1346), thanks [@​yuxi-liu-wired](https://github.com/yuxi-liu-wired)) - Fix comparison of large non-integer values with f32::INFINITY ([#​1347](serde-rs/json#1347), thanks [@​yuxi-liu-wired](https://github.com/yuxi-liu-wired)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjcuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE2Ny4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1934 Reviewed-by: Thomas de Zeeuw <thomas@futo.org>
DamianReeves
added a commit
to finos/morphir-rust
that referenced
this pull request
Oct 29, 2026
serde_json 1.0.152 preserves the sign of -0 in arbitrary_precision mode (serde-rs/json#1346), so the YAML reader's -0 is now stored with the lexeme -0 instead of 0. The invalid_literals test pinned the old, sign-folding behavior and failed on the rust-patch update to 1.0.154. The new behavior keeps the source spelling, so assert it, and require serde_json 1.0.152 in morphir-core so a crates.io build cannot resolve an older release that folds the sign. Beads: morphir-x4ep.1 Claude-Session: https://claude.ai/code/session_016vWNpLC7n2Fat4wgyZR75p
DamianReeves
added a commit
to finos/morphir-rust
that referenced
this pull request
Nov 1, 2026
serde_json 1.0.152 preserves the sign of -0 in arbitrary_precision mode (serde-rs/json#1346), so the YAML reader's -0 is now stored with the lexeme -0 instead of 0. The invalid_literals test pinned the old, sign-folding behavior and failed on the rust-patch update to 1.0.154. The new behavior keeps the source spelling, so assert it, and require serde_json 1.0.152 in morphir-core so a crates.io build cannot resolve an older release that folds the sign. Beads: morphir-x4ep.1 Claude-Session: https://claude.ai/code/session_016vWNpLC7n2Fat4wgyZR75p
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep the sign of -0 in Value with arbitrary_precision
Without
arbitrary_precisionthe integer literal-0deserializes tothe float -0.0, so a
Valuekeeps the sign. With the feature,parse_any_numberturned every integer that fits an i64 intoParserNumber::I64(d541381), and"-0".parse::<i64>()is 0, so thesign was lost:
-0now stays in the textual representation, so it is written back as-0and converts to -0.0, matching the behaviour without the featureand
test_parse_negative_zero.Test:
test_negative_zero_value(fails before this change with--features arbitrary_precision). Suite passes with no features,arbitrary_precision, +raw_value, +preserve_order,float_roundtrip, and
raw_value,preserve_order.
Testing
Each commit adds a regression test that fails before the change. The full test suite passes and
cargo fmt --checkis clean on the changed files.Found with a differential fuzzer comparing serde_json, simd-json, sonic-rs and jiter.