Skip to content

Incorrect PartialEq behavior for UnionFields #8936

@friendlymatthew

Description

@friendlymatthew

UnionFields represents a set of unique field ids paired with unique data types. Internally, it is stored as a list of (id, data type) tuples. However, because UnionFields currently derives PartialEq, equality is determined by the raw tuple list ordering rather than by set semantics

This leads to incorrect behavior, such as the following assertion failing even though the logical sets are identical:

assert_eq!(
    UnionFields::from(&[(0, t1), (1, t2)]),
    UnionFields::from(&[(1, t2), (0, t1)])
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions