-
Notifications
You must be signed in to change notification settings - Fork 122
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
std::net::IpAddr fails to roundtrip using 0.14.1 #235
Comments
Maybe this is related to #178 but that does supposedly not apply to serde version 1.0.81 or later? |
Yeah, that's a regression from #232 |
Pinging @Byron |
Thank you for figuring this out so quickly! |
@kornelski Does ExtDeserializer also need to return Here are the |
Sorry for being the cause of this with my sloppy PR. I would also think that all If nobody is on it yet, I could give @kabergstrom suggestion a try. |
I could reproduce the issue locally, but it wouldn't resolve itself when adding is_human_readable to all serializers/deserializers. When looking more closely into this particular implementation, you see it definitely does something different for binary serializers. Maybe serializing and deserializing newtype variants is actually incorrect right now? |
Update: I tried my luck, but couldn't really figure out why it's not working. A decent foundation for looking into this is in my master branch, providing a failing test and the fixes proposed by @kabergstrom, which seem good to have in any case. |
From IpAddr implementation it seems it needs I'm also surprised that it's not sufficient to add |
Value::Array(v) => {
let len = v.len();
let mut de = SeqDeserializer::new(v.into_iter());
let seq = visitor.visit_seq(&mut de)?;
if de.iter.len() == 0 {
Ok(seq)
} else {
Err(de::Error::invalid_length(len, &"fewer elements in array"))
}
} I suspect |
Good catch, looks like all |
Perhaps solution would be to make a newtype and then instead of |
@Byron would you like to try implementing "unreadable" wrapper for the |
I think I will, but I can only make myself do it when it starts blocking me. Working with anything 'serde' makes my brain twist itself in an attempt to understand what is calling what and how it all comes together. One moment I think I got it grokked, just to see that go away an instant later. Anyhow, I am already a happy user of |
I tried adding I also noticed that this test fails with the same error message, whether or not #[test]
fn roundtrip_result_num() {
let val: Result<u32, u32> = Ok(42);
assert_roundtrips(val);
} That test gives this error:
That may be unrelated, despite the similar error message. |
In the course of looking into this, I discovered that this appears to be a bug in serde, not in msgpack-rust: serde-rs/serde#1888 If I build msgpack-rust against a version of serde with that patch applied, the test case above passes, along with one of the existing ignored FIXME tests, and several additional tests I added. That fix also makes the tests pass with As soon as a version of Serde with that patch is released, it should be straightforward to add new |
#256 updates to the new serde and adds more tests. That should serve as a good foundation for adding new configuration for binary serialization. |
And #257 adds config support for binary vs human-readable. |
We recently updated from 0.14.0 to 0.14.1 (and to serde version 1.0.104) and the following minimal test case
started to fail with
The text was updated successfully, but these errors were encountered: