Skip to content

Commit

Permalink
Detect unknown struct variant fields deserializing from Value
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 28, 2021
1 parent 12207ed commit c7b7186
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/value/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ impl<'de> VariantAccess<'de> for VariantDeserializer {
V: Visitor<'de>,
{
match self.value {
Some(Value::Object(v)) => visitor.visit_map(MapDeserializer::new(v)),
Some(Value::Object(v)) => visit_object(v, visitor),
Some(other) => Err(serde::de::Error::invalid_type(
other.unexpected(),
&"struct variant",
Expand Down Expand Up @@ -1021,7 +1021,7 @@ impl<'de> VariantAccess<'de> for VariantRefDeserializer<'de> {
V: Visitor<'de>,
{
match self.value {
Some(&Value::Object(ref v)) => visitor.visit_map(MapRefDeserializer::new(v)),
Some(&Value::Object(ref v)) => visit_object_ref(v, visitor),
Some(other) => Err(serde::de::Error::invalid_type(
other.unexpected(),
&"struct variant",
Expand Down

0 comments on commit c7b7186

Please sign in to comment.