Integer values are limited by 2^63-1 (9223372036854775807).
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 265
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
Greetings!
Is there is a bug what integers are limited by 2^63-1?
use config::{Config, Environment, File, FileFormat};
fn main() {
// Ok
println!(
"number: `{}`.",
read_conf().get::<u64>("data.number").unwrap()
);
// Ok
std::env::set_var("PREFIX_data.number", (1u64 << 63 - 1).to_string());
println!(
"number: `{}`.",
read_conf().get::<u64>("data.number").unwrap()
);
// Error
std::env::set_var("PREFIX_data.number", (1u64 << 63).to_string());
println!(
"number: `{}`.",
read_conf().get::<u64>("data.number").unwrap_err()
);
}
#[inline]
fn read_conf() -> Config {
Config::builder()
.add_source(File::from_str("[data]\nnumber = 1024", FileFormat::Toml))
.add_source(Environment::with_prefix("PREFIX"))
.build()
.unwrap()
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Config builder and Environment source shown in the reproduction, then trace how the environment value is parsed and converted by get::. Check existing tests for environment sources or integer deserialization. Done means the reproduced u64 boundary case behaves correctly and regression coverage records the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100