Skip to content

fix(ron): map u64 values to ValueKind::U64 instead of lossy I64 cast#761

Merged
epage merged 1 commit into
rust-cli:mainfrom
greymoth-jp:greymoth-jp/fix/ron-u64-default
Jun 26, 2026
Merged

fix(ron): map u64 values to ValueKind::U64 instead of lossy I64 cast#761
epage merged 1 commit into
rust-cli:mainfrom
greymoth-jp:greymoth-jp/fix/ron-u64-default

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

Problem

ron::Number::U64 is currently handled as:

ron::Number::U64(value) => ValueKind::I64(value.try_into()?),

Any u64 value exceeding i64::MAX (~9.2e18) causes a try_into() error, silently breaking RON configs that use large unsigned integers.

Fix

Mirror the pattern applied to the JSON handler in #758:

ron::Number::U64(value) => ValueKind::U64(value),

Also removes the now-unused use std::convert::TryInto as _; import — TryInto is in the Rust 2021+ prelude, and keeping the import after removing the only try_into() call would produce an unused-import warning (CI runs with warnings-as-errors).

Verification

  • cargo build — clean, no warnings
  • cargo test — 166 tests pass (13 unit + 146 integration + 7 doc)

`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).
@epage

epage commented Jun 26, 2026

Copy link
Copy Markdown
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.

@epage epage merged commit ac0ee7b into rust-cli:main Jun 26, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants