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

deny_unknown_fields can break in 1.0.205 #2792

Closed
cpg314 opened this issue Aug 10, 2024 · 1 comment · Fixed by #2567
Closed

deny_unknown_fields can break in 1.0.205 #2792

cpg314 opened this issue Aug 10, 2024 · 1 comment · Fixed by #2567

Comments

@cpg314
Copy link

cpg314 commented Aug 10, 2024

The following (reduction of a less artificial example)

#[derive(serde::Deserialize)]
#[serde(deny_unknown_fields)]
enum A {
    B {
        c: String,
    },
    D {
        #[serde(flatten)]
        e: E,
    },
}
#[derive(serde::Deserialize)]
struct E {}

compiles fine with 1.0.204 but produces the following error in 1.0.205:

error[E0004]: non-exhaustive patterns: `<_::<impl Deserialize<'de> for A>::deserialize::__Visitor<'de> as Visitor<'de>>::visit_enum::__Field::__other(_)` not covered
 --> src/main.rs:1:10
  |
1 | #[derive(serde::Deserialize)]
  |          ^^^^^^^^^^^^^^^^^^ pattern `<_::<impl Deserialize<'de> for A>::deserialize::__Visitor<'de> as Visitor<'de>>::visit_enum::__Field::__other(_)` not covered
  |
note: `<_::<impl Deserialize<'de> for A>::deserialize::__Visitor<'de> as Visitor<'de>>::visit_enum::__Field<'_>` defined here
 --> src/main.rs:1:10
  |
1 | #[derive(serde::Deserialize)]
  |          ^^^^^^^^^^^^^^^^^^
  |          |
  |          not covered
  = note: the matched value is of type `<_::<impl Deserialize<'de> for A>::deserialize::__Visitor<'de> as Visitor<'de>>::visit_enum::__Field<'_>`
  = note: this error originates in the derive macro `serde::Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)

I have bisected the changes, and the issue appears in 32958de

@Mingun
Copy link
Contributor

Mingun commented Aug 10, 2024

#2567 fixes that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants