-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UnexpectedEof
when deserialize xs:list
s and newtypes
#660
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…zer and SeqItemDeserializer in deserialize_primitives! macro, because each deserializer should implement it the same as it's own deserialize_struct method
…ize_any deserialize_map already handles unwanted events gracefully, no need to process them outside of it
…sentation failures: ---- fixed_name::fixed_size::xs_list::empty stdout ---- [tests\helpers\mod.rs:14] source = "\n <root>\n <item/>\n </root>\n " thread 'fixed_name::fixed_size::xs_list::empty' panicked at tests/serde-de-seq.rs:871:18: called `Result::unwrap()` on an `Err` value: UnexpectedEof note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ---- fixed_name::variable_size::xs_list::empty stdout ---- [tests\helpers\mod.rs:14] source = "\n <root>\n <item/>\n </root>\n " thread 'fixed_name::variable_size::xs_list::empty' panicked at tests/serde-de-seq.rs:1697:18: called `Result::unwrap()` on an `Err` value: UnexpectedEof ---- variable_name::fixed_size::xs_list::empty stdout ---- [tests\helpers\mod.rs:14] source = "\n <root>\n <item/>\n </root>\n " thread 'variable_name::fixed_size::xs_list::empty' panicked at tests/serde-de-seq.rs:2967:18: called `Result::unwrap()` on an `Err` value: UnexpectedEof ---- variable_name::variable_size::xs_list::empty stdout ---- [tests\helpers\mod.rs:14] source = "\n <root>\n <item/>\n </root>\n " thread 'variable_name::variable_size::xs_list::empty' panicked at tests/serde-de-seq.rs:4066:18: called `Result::unwrap()` on an `Err` value: UnexpectedEof failures: fixed_name::fixed_size::xs_list::empty fixed_name::variable_size::xs_list::empty variable_name::fixed_size::xs_list::empty variable_name::variable_size::xs_list::empty
…g/> or <tag></tag>) Document the MapValueDeserializer and SeqItemDeserializer. The deserializers does not yet fully follows their descriptions, but that will be fixed in next commits
---- issue580 stdout ---- thread 'issue580' panicked at tests/serde-issues.rs:412:10: called `Result::unwrap()` on an `Err` value: Custom("invalid length 0, expected tuple struct Wrapper with 1 element") note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failures: issue580
…ct instead of visit_seq The problem was in `SeqItemDeserializer::deserialize_newtype_struct`. Previously it was the same as `SeqItemDeserializer::deserialize_seq`, but deserializing sequences in this deserializer assumes, that those sequences are `xs:list`s, because deserializer itself represents a list element. In the original bug report an `UnexpectedEof` is returning. The error was changed in the pre-previous commit (3d5ed69) and in this it is fixed. The following tests checks that all's OK: - Deserializer::deserialize_newtype_struct is reached by: - serde-de: - newtype::excess_attribute - newtype::simple - serde-se: - with_root::newtype - without_root::newtype - MapValueDeserializer::deserialize_newtype_struct is reached by: - serde-issues: - issue343 - SeqItemDeserializer::deserialize_newtype_struct is reached by: - serde-issues: - issue580
Deserializers are still does not fully follow updated documentation for them. They will be aligned with it in the following PR for #567. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem with #590 was in
SeqItemDeserializer::deserialize_newtype_struct
. Previously it was the same asSeqItemDeserializer::deserialize_seq
, but deserializing sequences in this deserializer assumes, that those sequences arexs:list
s, because deserializer itself represents a list element.Also, I noticed, that
<tag></tag>
(or<tag/>
) could return and error when try to deserializexs:list
from it. Funny, that due to incorrect implementation instead ofUnsupported("unsupported event End")
theUnexpectedEof
was returned.Fixes #580