Skip to content
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

Error round-tripping complex struct #17

Closed
casey opened this issue Jan 30, 2020 · 1 comment · Fixed by #27
Closed

Error round-tripping complex struct #17

casey opened this issue Jan 30, 2020 · 1 comment · Fixed by #27

Comments

@casey
Copy link
Contributor

casey commented Jan 30, 2020

I ran into a problem deserializing a complex struct:

fn ser_de_field_vec_tuple() {
    #[derive(Deserialize, Serialize, Eq, PartialEq, Debug)]
    struct Foo {
        bar: Vec<(u16,)>,
    }

    let foo = Foo {
        bar: vec![(1,), (3,)],
    };

    test_ser_de_eq(foo);
}

The error message is InvalidType("Invalid Type: sequence (expected: field identifier)")'

I wasn't able reduce the test case by removing the struct, the vec, or the tuple, so it seems to be some weird combination of the three.

@0xcaff
Copy link
Collaborator

0xcaff commented Feb 6, 2020

I wonder whether this happens with nested Vecs also. Will take a look eventually maybe.

madadam added a commit to madadam/serde-bencode that referenced this issue Nov 11, 2021
madadam added a commit that referenced this issue Nov 11, 2021
Add test for ser/de of struct with vec of tuples (issue #17)
josecelano added a commit that referenced this issue Oct 9, 2023
f58baf7 chore: undo package rename (Jose Celano)
9833274 tests: add unit test for Value with serde_test (Jose Celano)
f94c198 chore: add dev dependency serde_test (Jose Celano)
1eab404 test: add unit tests to Value (Jose Celano)
b85b2a4 chore: add code coverage dir to gitignore (Jose Celano)
97168c5 chore: normalize todo mark to lowercase (Jose Celano)
e2751eb chore(dev): add cargo alias (Jose Celano)
fd7bdce test: add more tests for torrent files (Jose Celano)
9efb5e8 tests: enable tests with potencial unintended behavior (Jose Celano)
a7fd343 test: add more failing tests (Jose Celano)
a7587d4 docs: fix coverage workflow badge in README (Jose Celano)
252849f ci: add coverage workflow (Jose Celano)
5bc8202 ci: ignore failing tests (Jose Celano)
36e31ae docs: fix workflow badge link in README (Jose Celano)
885ebe9 chrore: update cSpell dictionary (Jose Celano)
5e9dd5c test: enable test (Jose Celano)
1ea262d ci: add benchmarking workflow (Jose Celano)
b3b2a44 fix: [#9] Clipply errors (Jose Celano)
cdd4200 fix: cargo build errors (Jose Celano)
caf8cf5 doc: add new workflow badgets to README (Jose Celano)
b3759c1 chore: bump actions/checkout from 3 to 4 (Jose Celano)
5b35fd7 ci: add cargo config (Jose Celano)
a833a34 ci: add formatting and checking workflows (Jose Celano)
e88aeec doc: add testing workflow badget to README (Jose Celano)
47549ef ci: add dependabot config (Jose Celano)
6ce2e9d test: add a failing test for nested list deserialization (Jose Celano)
decdff6 Avoid eagerly allocating too much memory (5225225)
a1597cc Add cargo-fuzz fuzzer (5225225)
43ba81e Introduce failing test for flattened enums (Nicholas Rempel)
625081a new torrust-serde-bencode package (Jose Celano)
403f043 Add test for ser/de of struct with vec of tuples (issue #17) (Adam Cigánek)
4faf05f Minor change to support rust version >= 1.40.0 (Adam Cigánek)
0c6c144 Fix deserialization of nested tuple (Adam Cigánek)
06bb9a6 Fix deserialization of flattened adjacently tagged enum (Adam Cigánek)
79b7540 Fix deserialization of adjacently tagged enums (Adam Cigánek)
1eecff4 Fix warnings and clippy lints (Adam Cigánek)
e6f9b53 Apply rustfmt (Adam Cigánek)

Pull request description:

  I have been working on a fork because this project was inactive, but I contacted @toby, who made me a maintainer and gave it access to publish new versions.

  I was trying to fix a bug I found [here](torrust/torrust-index#266). . After debugging, I realized the bug was already fixed in this repo but has yet to be included in a new release.

  I've been working on the fork and I would like to merge those changes back and publish the version `v0.2.4` on [crates.io](https://crates.io/crates/serde_bencode).

  The changes I've made so far are:

  - Fix cargo build and clippy warnings.
  - Merge PRs that were ready to merge.
  - Update dependencies.
  - Add GitHub workflows for checking, formatting, testing, benchmarking and coverage.
  - Add tests for torrent files, which I suppose is the most common use for this package.
  - Add unit tests for `Value` struct.

ACKs for top commit:
  josecelano:
    ACK e894328

Tree-SHA512: 331e82dba9e0a8f4f2c9be30a09537707c39e05223d601bbfb7f6792a7e7e95b9bf60a65b097ed6ee2aea0e2c22196a8d6ded8c82cd9a59db274774002e50370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants