fix(ron): map u64 values to ValueKind::U64 instead of lossy I64 cast#761
Merged
Merged
Conversation
`ron::Number::U64` was cast via `try_into()?` to `ValueKind::I64`, which silently errors for any value exceeding `i64::MAX` (~9.2e18). Mirror the fix applied to the JSON handler in PR rust-cli#758: map U64 directly to `ValueKind::U64(value)`. Also removes the now-unused `use std::convert::TryInto as _;` import (TryInto is in the Rust 2021+ prelude; keeping it would trigger an unused-import warning).
Contributor
|
I'd recommend focusing PR descriptions on what is most relevant to the reviewer. For example, speaking of verification covered by CI is less relevant. Whether this change is covered by a test or why a test was not added. |
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.
Problem
ron::Number::U64is currently handled as:Any
u64value exceedingi64::MAX(~9.2e18) causes atry_into()error, silently breaking RON configs that use large unsigned integers.Fix
Mirror the pattern applied to the JSON handler in #758:
Also removes the now-unused
use std::convert::TryInto as _;import —TryIntois in the Rust 2021+ prelude, and keeping the import after removing the onlytry_into()call would produce an unused-import warning (CI runs with warnings-as-errors).Verification
cargo build— clean, no warningscargo test— 166 tests pass (13 unit + 146 integration + 7 doc)