Skip to content

Deriving Deserialize for a remote generic enum fails #972

Closed
@r3c0d3x

Description

@r3c0d3x

I'm attempting to derive Deserialize and Serialize for the Or enum from the or crate.

Deriving Serialize works fine:

#[derive(Serialize)] #[serde(untagged, remote = "Or")] enum OrDef<A, B> { A(A), B(B) }

but deriving Deserialize doesn't:

#[derive(Deserialize)] #[serde(untagged, remote = "Or")] enum OrDef<A, B> { A(A), B(B) }

serde_derive should be able to automatically write the type bounds for it's impl, but it is omitting them.

What's even stranger (and helps show the issue) is that, when we remove the remote = "Or", it compiles just fine:

#[derive(Deserialize)] #[serde(untagged)] enum Or<A, B> { A(A), B(B) }

[dependencies]
or = "*"
serde = "1.0.8"
serde_derive = "1.0.8"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions