Skip to content

serde: integers past i32 deserialize as floats on 32-bit targets #753

Closed

Description

@FalkWoldmann

With Luau on a 32-bit target, Integer is i32, so a whole number past that range comes back as Value::Number, and from_value hands it to serde as an f64. Deserializing it into an integer type then fails:

let value: Value = lua.load("return 3000000000").eval()?;
lua.from_value::<u64>(value) // i686: Err(invalid type: floating point `3000000000.0`, expected u64)

On 64-bit that's Ok(3000000000). I think the integer hints (deserialize_u64 and friends) could visit an integral Value::Number as an integer instead of forwarding to deserialize_any, so 64-bit wouldn't change. We hit this in maki's provider plugins on i686. Would you take a PR for this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions