From c7b71869571ad1825a5983df84d05760769ec71f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 28 Aug 2021 11:21:54 -0700 Subject: [PATCH] Detect unknown struct variant fields deserializing from Value --- src/value/de.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value/de.rs b/src/value/de.rs index 5ff011961..24ca82696 100644 --- a/src/value/de.rs +++ b/src/value/de.rs @@ -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", @@ -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",