File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -883,17 +883,16 @@ where
883883 }
884884
885885 /// Forwards deserialization of the inner type. Always calls [`Visitor::visit_newtype_struct`]
886- /// with the [`SimpleTypeDeserializer`] .
886+ /// with this deserializer .
887887 fn deserialize_newtype_struct < V > (
888- mut self ,
888+ self ,
889889 _name : & ' static str ,
890890 visitor : V ,
891891 ) -> Result < V :: Value , Self :: Error >
892892 where
893893 V : Visitor < ' de > ,
894894 {
895- let text = self . read_string ( ) ?;
896- visitor. visit_newtype_struct ( SimpleTypeDeserializer :: from_text ( text) )
895+ visitor. visit_newtype_struct ( self )
897896 }
898897
899898 /// This method deserializes a sequence inside of element that itself is a
Original file line number Diff line number Diff line change 55use pretty_assertions:: assert_eq;
66use quick_xml:: de:: from_str;
77use quick_xml:: se:: { to_string, to_string_with_root} ;
8- use serde:: { Deserialize , Deserializer , Serialize } ;
8+ use serde:: de:: { Deserializer , IgnoredAny } ;
9+ use serde:: { Deserialize , Serialize } ;
910use std:: collections:: HashMap ;
1011
1112/// Regression tests for https://github.com/tafia/quick-xml/issues/252.
@@ -393,10 +394,13 @@ fn issue580() {
393394 #[ derive( Debug , PartialEq , Eq ) ]
394395 struct Item ;
395396 impl Item {
396- fn parse < ' de , D > ( _deserializer : D ) -> Result < Self , D :: Error >
397+ fn parse < ' de , D > ( deserializer : D ) -> Result < Self , D :: Error >
397398 where
398399 D : Deserializer < ' de > ,
399400 {
401+ // We should consume something from the deserializer, otherwise this
402+ // leads to infinity loop
403+ IgnoredAny :: deserialize ( deserializer) ?;
400404 Ok ( Item )
401405 }
402406 }
You can’t perform that action at this time.
0 commit comments