diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs index 50ae6ed15..881b1a5b4 100644 --- a/serde/src/private/de.rs +++ b/serde/src/private/de.rs @@ -212,7 +212,7 @@ mod content { use crate::de::value::{MapDeserializer, SeqDeserializer}; use crate::de::{ self, size_hint, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, - IgnoredAny, MapAccess, SeqAccess, Unexpected, Visitor, + IgnoredAny, MapAccess, SeqAccess, Unexpected, VariantAccess, Visitor, }; /// Used from generated code to buffer the contents of the Deserializer when @@ -525,12 +525,17 @@ mod content { Ok(Content::Map(vec)) } - fn visit_enum(self, _visitor: V) -> Result + fn visit_enum(self, visitor: V) -> Result where V: EnumAccess<'de>, { - Err(de::Error::custom( - "untagged and internally tagged enums do not support enum input", + let (key, data) = tri!(visitor.variant::()); + Ok(Content::Map( + [( + Content::String(key), + tri!(data.newtype_variant::()), + )] + .into(), )) } }