-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Make Compare traits have ~const super traits. #107820
Conversation
r? @cuviper (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
@rustbot label +T-libs-api -T-libs |
r? libs-api |
a12e275
to
93531e5
Compare
= help: the trait `~const PartialOrd` is not implemented for `*const ()` | ||
note: the trait `PartialOrd` is implemented for `*const ()`, but that implementation is not `const` | ||
= help: the trait `~const PartialOrd<_>` is not implemented for `*const ()` | ||
note: the trait `PartialOrd<_>` is implemented for `*const ()`, but that implementation is not `const` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those diagnostics changes are kind of bad, but I'm not really sure what causes them / how to fix them
@@ -1032,7 +1047,7 @@ pub macro Ord($item:item) { | |||
)] | |||
#[const_trait] | |||
#[rustc_diagnostic_item = "PartialOrd"] | |||
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> { | |||
pub trait PartialOrd<Rhs: ?Sized = Self>: ~const PartialEq<Rhs> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change causes the diagnostic regression, but I don't understand why, maybe caused by something in the compiler?
@oli-obk Do you know what causes this / how to fix it?
I'm also not certain if we really want |
☔ The latest upstream changes (presumably #110393) made this pull request unmergeable. Please resolve the merge conflicts. |
For the near future we're avoiding any kind of ~const in libcore/libstd. We just removed all of it and will implement it from scratch just within ui tests. I'm closing this PR as it's not actionable right now. |
see #110395 |
This changes the trait definitions for
Eq
,PartialOrd
andOrd
to have ~const super trait bounds.This simplifies const code that uses (for example) both the
Ord
andPartialEq
Traits since no additional trait bounds will have to be added for those (only the existing ones changed to ~const).cc @fee1-dead