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

Correctly process flatten fields in enum variants #2567

Merged
merged 4 commits into from
Aug 11, 2024

Commits on Aug 9, 2024

  1. Add regression test for issue serde-rs#2565

    failures (1):
        regression::issue2565::simple_variant
    Mingun committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    24614e4 View commit details
    Browse the repository at this point in the history
  2. Add regression test for issue serde-rs#1904

    Currently panics in derive:
    
    error: proc-macro derive panicked
        --> test_suite\tests\test_annotations.rs:2386:25
         |
    2386 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                         ^^^^^^^^^^^
         |
         = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
      --> test_suite\tests\regression\issue1904.rs:57:10
       |
    57 | #[derive(Deserialize)]
       |          ^^^^^^^^^^^
       |
       = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
      --> test_suite\tests\regression\issue1904.rs:47:10
       |
    47 | #[derive(Deserialize)]
       |          ^^^^^^^^^^^
       |
       = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
      --> test_suite\tests\regression\issue1904.rs:37:10
       |
    37 | #[derive(Deserialize)]
       |          ^^^^^^^^^^^
       |
       = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
      --> test_suite\tests\regression\issue1904.rs:27:10
       |
    27 | #[derive(Deserialize)]
       |          ^^^^^^^^^^^
       |
       = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
      --> test_suite\tests\regression\issue1904.rs:16:10
       |
    16 | #[derive(Deserialize)]
       |          ^^^^^^^^^^^
       |
       = help: message: assertion failed: !cattrs.has_flatten()
    
    error: proc-macro derive panicked
     --> test_suite\tests\regression\issue1904.rs:7:10
      |
    7 | #[derive(Deserialize)]
      |          ^^^^^^^^^^^
      |
      = help: message: assertion failed: !cattrs.has_flatten()
    Mingun committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    c3ac7b6 View commit details
    Browse the repository at this point in the history
  3. Correctly process flatten fields in enum variants

    - Fix incorrect deserialization of variants that doesn't contain flatten field when other contains
    - Fix a panic when deriving `Deserialize` for an enum with tuple and struct with flatten field
    
    Fixes (2):
        regression::issue2565::simple_variant
        regression::issue1904 (compilation)
    Mingun committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    b4ec259 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2024

  1. Configuration menu
    Copy the full SHA
    2afe5b4 View commit details
    Browse the repository at this point in the history