-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add a warning that flatten
and deny_unknown_fields
should not be mixed.
#120
Conversation
_src/field-attrs.md
Outdated
@@ -38,6 +38,10 @@ | |||
with arbitrary string keys. The [struct flattening](attr-flatten.md) page | |||
provides some examples. | |||
|
|||
*Note:* This attribute clashes with [`flatten`](attr-flatten.md) and might |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am reading this correctly, this line says that flatten
clashes with flatten
. Clashing attributes is bad, but it's not quite that bad!
_src/attr-flatten.md
Outdated
@@ -5,6 +5,9 @@ The `flatten` attribute inlines keys from a field into the parent struct. | |||
supported only within structs that have named fields, and the field to which it | |||
is applied must be a struct or map type. | |||
|
|||
*Note:* This attribute clashes with `flatten` and might make the struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here -- this claims flatten
clashes with flatten
.
…mixed. There are various bug reports about the interaction of `flatten` and `deny_unknown_fields`. In the end they cannot really be combined, since flatten does not consume the fields thus `deny_unknown_fields` will error on them. serde-rs/serde#1957 serde-rs/serde#1600 serde-rs/serde#1547
@dtolnay Thank you for the comment. Yes I messed up the description while hastily creating this PR. I fixed the mistake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There are various bug reports about the interaction of
flatten
anddeny_unknown_fields
. In the end they cannot really be combined, sinceflatten does not consume the fields thus
deny_unknown_fields
will erroron them.
serde-rs/serde#1957
serde-rs/serde#1600
serde-rs/serde#1547
I'm happy to update the wording of the notice to include any suggestions.