Skip to content
New issue

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

Fix internally tagged enum deserialization with unknown fields #1376

Merged
merged 2 commits into from Sep 7, 2018
Merged

Fix internally tagged enum deserialization with unknown fields #1376

merged 2 commits into from Sep 7, 2018

Conversation

dreid
Copy link
Contributor

@dreid dreid commented Sep 6, 2018

Currently an internally tagged enum with a unit variant will fail to deserialize if the map contains unknown fields.

Example on Playground

This change attempts to address that by having the InternallyTaggedUnitVisitor.visit_map method consume the map before returning.

I've added a test case for the simple enum case and for the case where the unit enum variant is flattened into a struct.

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, nicely done.

@dtolnay dtolnay merged commit 8d5cda8 into serde-rs:master Sep 7, 2018
@dtolnay
Copy link
Member

dtolnay commented Sep 7, 2018

I released this fix in 1.0.77.

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.

None yet

2 participants