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

Internally tagged enum deserialization regression in 1.0.39 #1222

Closed
sfackler opened this issue Apr 20, 2018 · 1 comment
Closed

Internally tagged enum deserialization regression in 1.0.39 #1222

sfackler opened this issue Apr 20, 2018 · 1 comment
Labels

Comments

@sfackler
Copy link
Contributor

This program succeeds on 1.0.38 but fails on 1.0.39 and 1.0.40:

extern crate serde_cbor;

#[macro_use]
extern crate serde_derive;

#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[serde(tag = "type")]
enum Foo {
    Foo { bar: u32 },
}

fn main() {
    let val = Foo::Foo { bar: 2 };
    let bytes = serde_cbor::to_vec(&val).unwrap();
    let val2 = serde_cbor::from_slice(&bytes).unwrap();

    assert_eq!(val, val2);
}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("invalid type: integer `2`, expected u32"), offset: 0 }', libcore/result.rs:945:5
@sfackler sfackler changed the title Adjacently tagged enum deserialization regression in 1.0.39 Internally tagged enum deserialization regression in 1.0.39 Apr 20, 2018
@dtolnay dtolnay added the bug label Apr 20, 2018
@dtolnay
Copy link
Member

dtolnay commented Apr 20, 2018

Thanks, I released 1.0.41 with a fix -- 85ca12a.

@dtolnay dtolnay closed this as completed Apr 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants