Ord and PartialOrd derives do not specify ordering behavior types with multiple fields #109946
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Location
Derive macros for Ord and PartialOrd.
Summary
The derive macros for Ord and PartialOrd do not specify what the order of precedence it generates in the resulting implementation. This order matters, and makes reordering fields on a type with this derive a semver-incompatible breaking change.
Examples
Does
field_1
take precedence overfield_2
when comparing twoMyStruct
s?Do all
Variant_1
come before or afterVariant_2
?The text was updated successfully, but these errors were encountered: