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
Edge case where RON fails but all other serde format types succeed #152
Comments
Any idea how does this differ from a general case that is expected to work with RON? |
How do you mean exactly? I've updated the test case showing working cases vs. non-working cases with bitflags vs. option_set. The update shows that bitflags works for both ron and serde_json, while option_set works with serde_json but NOT ron. I'm not sure what details you need. Update here: |
Hm weird. I mean, the |
Oh! I totally failed to connect the dots that that was you! I've added bitflags_serial to the test case. I've added a test case for bitflags_serial, which also appears to fail for JSON and RON. Test Output Is: |
As an additional, I've noticed there are cases where it DOES work with amethyst assets RonFormat loader, though. So it appears maybe its a difference between from_str and from_bytes? I cannot replicate from_bytes working though in my case. |
Update: I've also confirmed it fails with stable (I am using latest nightly). |
As referenced in that PR to bitflags-serial, I'm not sure if this is a bug in bitflags-serial or RON. it appears to be because of the call to the unimplemented visit_str, instead of the originally implemented visit_bytes. But I don't know serde or RON well enough though to say why this is the case. |
Fixed with #352 |
Using any format of bitflags serialization, I seem to have found, somehow, a way in which RON fails to deserialize values, but all other serde serializers seem to handle just fine. I don't understand serde enough to understand what is incorrect about the RON implementation.
Error is: thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: Message("invalid type: string "One", expected a borrowed string")', src/libcore/result.rs:997:5Specifically, I could at least trace the error down to this line: https://github.com/kvark/bitflags-serial/blob/master/src/lib.rs#L66
or this line
https://github.com/H2CO3/option_set/blob/master/src/lib.rs#L242
I've created a repo minimally showing the issue here: https://github.com/jaynus/ron_fail_poc
I ran into this using RON originally with bitflags_serial (https://github.com/kvark/bitflags-serial). I then swapped to option_set in an attempt to fix it, and ran into the same issue.
The text was updated successfully, but these errors were encountered: