Skip to content

Fix hand-written enum variant deserializations to allow u64 discriminant#1888

Merged
dtolnay merged 1 commit intoserde-rs:masterfrom
joshtriplett:fix-enum-deserialization-u64
Sep 11, 2020
Merged

Fix hand-written enum variant deserializations to allow u64 discriminant#1888
dtolnay merged 1 commit intoserde-rs:masterfrom
joshtriplett:fix-enum-deserialization-u64

Conversation

@joshtriplett
Copy link
Contributor

Automatically generated enum variant deserializers allowed any integer
type as the discriminant, but the hand-written ones for specific enum
types such as Result or IpAddr only allowed types up to u32. This broke
some non-human-readable deserializers for these enums, with
deserializers that emit any integer type as a u64. Switch the visit_u32
methods to visit_u64 methods to allow discriminants to have any size up
to a u64.

Automatically generated enum variant deserializers allowed any integer
type as the discriminant, but the hand-written ones for specific enum
types such as Result or IpAddr only allowed types up to u32. This broke
some non-human-readable deserializers for these enums, with
deserializers that emit any integer type as a u64. Switch the visit_u32
methods to visit_u64 methods to allow discriminants to have any size up
to a u64.
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This was missed from #963.

@dtolnay dtolnay merged commit a5490e2 into serde-rs:master Sep 11, 2020
@joshtriplett joshtriplett deleted the fix-enum-deserialization-u64 branch September 11, 2020 20:24
@joshtriplett
Copy link
Contributor Author

Thanks for the quick review and merge, and the 1.0.116 release!

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants