Skip to content

parsing of number -9223372036854775809 (i64 min -1) fails with error? #447

@pabrAtGithub

Description

@pabrAtGithub

Hi,

i can't parse this number without an error. Is this a bug or am i doing something wrong?

#[test]
fn min_i64_minus_one() {
    let mut d = String::from(r#"{"my_value": -9223372036854775809}"#);
    let d = unsafe { d.as_bytes_mut() };
    let v_serde: serde_json::Value = serde_json::from_slice(d).expect("");
    let v_simd: serde_json::Value = from_slice(d).expect(""); // fails here
    assert_eq!(v_simd, v_serde);
}

fails with

---- tests::serde::min_i64_minus_one stdout ----

thread 'tests::serde::min_i64_minus_one' (3727427) panicked at src/tests/serde.rs:482:51:
: Error { index: 33, character: Some('}'), err_type: InvalidNumber }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Please advise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions