We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toml
For large u64 values, tom::to_string generates negative u64 numbers.
tom::to_string
Code:
use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize)] pub struct Config { pub seed: u64, } fn main() { let cfg = Config { seed: 16237911273155533842, }; println!("{}", toml::to_string(&cfg).unwrap()); }
Running it:
~/code/github/repro/repro-2 ❯ cargo run --release Compiling repro-2 v0.1.0 (/Users/maxime/Code/github/repro/repro-2) Finished release [optimized] target(s) in 0.78s Running `target/release/repro-2` seed = -2208832800554017774 ~/code/github/repro/repro-2 ❯ cargo run Compiling repro-2 v0.1.0 (/Users/maxime/Code/github/repro/repro-2) Finished dev [unoptimized + debuginfo] target(s) in 0.29s Running `target/debug/repro-2` seed = -2208832800554017774
Rust version:
~/code/github/repro/repro-2 ❯ rustc --version rustc 1.67.0 (fc594f156 2023-01-24) ~/code/github/repro/repro-2 ❯ cargo version cargo 1.67.0 (8ecd4f20a 2023-01-10)
Crate versions:
~/code/github/repro/repro-2 ❯ cargo tree repro-2 v0.1.0 (/Users/maxime/Code/github/repro/repro-2) ├── serde v1.0.152 │ └── serde_derive v1.0.152 (proc-macro) │ ├── proc-macro2 v1.0.51 │ │ └── unicode-ident v1.0.6 │ ├── quote v1.0.23 │ │ └── proc-macro2 v1.0.51 (*) │ └── syn v1.0.107 │ ├── proc-macro2 v1.0.51 (*) │ ├── quote v1.0.23 (*) │ └── unicode-ident v1.0.6 └── toml v0.7.1 ├── serde v1.0.152 (*) ├── serde_spanned v0.6.1 │ └── serde v1.0.152 (*) ├── toml_datetime v0.6.1 │ └── serde v1.0.152 (*) └── toml_edit v0.19.2 ├── indexmap v1.9.2 │ └── hashbrown v0.12.3 │ [build-dependencies] │ └── autocfg v1.1.0 ├── nom8 v0.2.0 │ └── memchr v2.5.0 ├── serde v1.0.152 (*) ├── serde_spanned v0.6.1 (*) └── toml_datetime v0.6.1 (*)
Setup:
OS: macOS 13.2 22D49 arm64 Host: MacBookPro18,1 CPU: Apple M1 Pro
I am not able to reproduce this bug in the Rust Playground.
The text was updated successfully, but these errors were encountered:
fix(ser): Error on too-large u64
d6964ab
This is better than going negative Fixes toml-rs#511
Successfully merging a pull request may close this issue.
For large u64 values,
tom::to_string
generates negative u64 numbers.Code:
Running it:
Rust version:
Crate versions:
Setup:
I am not able to reproduce this bug in the Rust Playground.
The text was updated successfully, but these errors were encountered: