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

Fix incorrect count of fields passed to tuple deserialization methods #2466

Merged
merged 1 commit into from Jun 8, 2023

Conversation

Mingun
Copy link
Contributor

@Mingun Mingun commented May 28, 2023

This count should mean the number of fields expected in the serialized form, so if some fields are skipped, they shouldn't be counted.

Methods affected:

  • Deserializer::deserialize_tuple
  • Deserializer::deserialize_tuple_struct
  • VariantAccess::tuple_variant

After this PR number of fields passed to deserializer methods will be the same as number, passed to the serializer methods.

I didn't include tests in that PR, because correct test suite should cover all possible situations, and many of them have certain problems. I plan to include a full testsuite in my upcoming PR for fixing #2105.

Right now you can see what changed in the generated code by running the following commands:

  • place skip.txt into test_suite/tests folder and change its extension to .rs
  • run the following command in master and this PR and compare the generated output:
    ...\serde\test_suite> cargo expand --all-features --test skip

This count should mean the number of fields expected in the serialized form,
so if some fields are skipped, they shouldn't be counted

Methods affected:
- Deserializer::deserialize_tuple
- Deserializer::deserialize_tuple_struct
- VariantAccess::tuple_variant
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit 8a4dfa7 into serde-rs:master Jun 8, 2023
19 checks passed
@Mingun Mingun deleted the fix-de-count-of-field branch June 8, 2023 05:27
crapStone added a commit to Calciumdibromid/CaBr2 that referenced this pull request Jul 7, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [serde](https://serde.rs) ([source](https://github.com/serde-rs/serde)) | dependencies | patch | `1.0.164` -> `1.0.167` |

---

### Release Notes

<details>
<summary>serde-rs/serde (serde)</summary>

### [`v1.0.167`](https://github.com/serde-rs/serde/releases/tag/v1.0.167)

[Compare Source](serde-rs/serde@v1.0.166...v1.0.167)

-   Add serialize and deserialize impls for `RangeFrom` and `RangeTo` ([#&#8203;2471](serde-rs/serde#2471), thanks [@&#8203;tbu-](https://github.com/tbu-))

### [`v1.0.166`](https://github.com/serde-rs/serde/releases/tag/v1.0.166)

[Compare Source](serde-rs/serde@v1.0.165...v1.0.166)

-   Add `no-alloc` category to crates.io metadata

### [`v1.0.165`](https://github.com/serde-rs/serde/releases/tag/v1.0.165)

[Compare Source](serde-rs/serde@v1.0.164...v1.0.165)

-   Fix incorrect count of fields passed to tuple deserialization methods when using `serde(skip_deserializing)` attributes ([#&#8203;2466](serde-rs/serde#2466), thanks [@&#8203;Mingun](https://github.com/Mingun))
-   Fix `-Zminimal-versions` build

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNi4xLjExIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCJ9-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Co-authored-by: crapStone <crapstone01@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1953
Reviewed-by: crapStone <crapstone01@gmail.com>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants