-
Notifications
You must be signed in to change notification settings - Fork 13.8k
add [const] PartialEq
bound to PartialOrd
#146690
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
Conversation
This change is included for discussion purposes. The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
I don't have a great answer, but I think this makes sense. If nothing else, it seems more usable: having a type that is Cc @rust-lang/wg-const-eval for thoughts. |
we do not elaborate without being involved in any of the design here, i would expect at least a lint that super traits also have to maybe-const for const sub-traits |
This sounds like something that would be helpful. Perhaps just not in cases where the super trait doesn't have any functions, e.g.: pub trait A {
const FOO: u32 = 10;
}
pub const trait B: A {
fn foo() -> u32 { Self::FOO }
} In any case, the change here seems reasonable and looks like it got some 👍 from relevant people, so @bors r+ rollup |
add `[const] PartialEq` bound to `PartialOrd` This change is included for discussion purposes. The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
Rollup of 5 pull requests Successful merges: - #146690 (add `[const] PartialEq` bound to `PartialOrd`) - #146776 (fixes for numerous clippy warnings) - #146777 (fix ./x readdir logic when CDPATH is set) - #146781 (mbe: Fix feature gate for `macro_derive`) - #146785 (btree: safety comments for init and new) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #146690 - npmccallum:convo, r=tgross35 add `[const] PartialEq` bound to `PartialOrd` This change is included for discussion purposes. The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
add `[const] PartialEq` bound to `PartialOrd` This change is included for discussion purposes. The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#146690 (add `[const] PartialEq` bound to `PartialOrd`) - rust-lang#146776 (fixes for numerous clippy warnings) - rust-lang#146777 (fix ./x readdir logic when CDPATH is set) - rust-lang#146781 (mbe: Fix feature gate for `macro_derive`) - rust-lang#146785 (btree: safety comments for init and new) r? `@ghost` `@rustbot` modify labels: rollup
add `[const] PartialEq` bound to `PartialOrd` This change is included for discussion purposes. The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?
This change is included for discussion purposes.
The PartialOrd bound on PartialEq is not strictly necessary. It is, rather, logical: anything which is orderable should by definition have equality. Is the same true for constness? Should every type which is const orderable also have const equality?