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

serde flatten causes parent element propagation #294

Closed
outergod opened this issue Jul 14, 2021 · 1 comment
Closed

serde flatten causes parent element propagation #294

outergod opened this issue Jul 14, 2021 · 1 comment
Labels
bug serde Issues related to mapping from Rust types to XML

Comments

@outergod
Copy link

outergod commented Jul 14, 2021

Related Gist: https://gist.github.com/e-user/43b4dedce72c4fd80757fb262a6a2f36
Expected outcome: Code from Gist runs without errors
Actual outcome:

thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"<root><another><root/></another></root>"`,
 right: `"<root><another/></root>"`', src/main.rs:42:5

This is the most condensed version I could figure out to reproduce this error and included a JSON version to demonstrate the bug is most likely not in upstream serde itself. It works at arbitraty depths, not just the root element - one a flattened HashMap gets involved, its parent element somehow gets propageted to its own as well as all siblings' child elements as well as its descendents.

Addendum: It doesn't have to be a HashMap which is flattened, it works on any non-unit struct:

pub struct Props {}
@Mingun Mingun added bug serde Issues related to mapping from Rust types to XML labels May 21, 2022
@Mingun
Copy link
Collaborator

Mingun commented May 25, 2022

Duplicate of #343

@Mingun Mingun marked this as a duplicate of #343 May 25, 2022
@Mingun Mingun closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug serde Issues related to mapping from Rust types to XML
Projects
None yet
Development

No branches or pull requests

2 participants