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 representation of tuples with skipped fields #2520

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Aug 7, 2023

  1. Move code that generates reading from a SeqAccess to a dedicated func…

    …tion
    
    (review this with whitespace changes ignored)
    Mingun committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    c0f684b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1a1f102 View commit details
    Browse the repository at this point in the history
  3. Inline deserialize_newtype_struct and `deserialize_newtype_struct_i…

    …n_place`
    
    Those functions too small and used only once
    
    (review this with whitespace changes ignored)
    Mingun committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    2a61b2e View commit details
    Browse the repository at this point in the history
  4. Correctly process skipped fields in visit_newtype_struct

    Changes in generated code (see the file attached to PR):
      Tuple1as0:
      Tuple1as0Default:
      Tuple1as0With:
        fixed visit_newtype_struct: use default value instead of deserializing it
    
    This fixes compilation error for Deserialize side of Tuple1as0(Skipped) tuple
    Mingun committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    4648d92 View commit details
    Browse the repository at this point in the history
  5. Add tests for skipped fields in different kinds of structs

    Enums out of scope for now, because they have too many problems
    
    failures (1):
        tuple_struct::tuple2as1
    
    compilation error (commented):
        tuple_struct::tuple1as0
    Mingun committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    c9d82e1 View commit details
    Browse the repository at this point in the history
  6. Change Tuple1as0(Skipped) representation: newtype -> tuple(0), simila…

    …r to Tuple0() struct
    
    A side-effect: Tuple2as1(Skipped, x) now also can be deserialized using visit_newtype_struct
    
    Changes in generated code (see the file attached to PR):
      Tuple1as0:
      Tuple1as0Default:
      Tuple1as0With:
        removed visit_newtype_struct, *_newtype_struct -> *_tuple_struct(0)
    
      Tuple2as1:
      Tuple2as1Default:
      Tuple2as1With:
        added visit_newtype_struct
    
    This commit fixes compilation error and actually fixes the issue as it was reported in serde-rs#2105
    Mingun committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    edb53a2 View commit details
    Browse the repository at this point in the history