-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Cheap derive(PartialOrd) for non-generic types #155537
Copy link
Copy link
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
If a non-generic type derives both
PartialOrdandOrd, thePartialOrdimpl can just do this:(It won't work for generic types because the trait bounds on the generic parameters won't be right.)
This will likely be faster to compiler than a full implementation. It might also be a little easier for the backend to optimize.
Some futher discussion is on Zulip here.