implement Ord for OutlivesPredicate and other types#50930
implement Ord for OutlivesPredicate and other types#50930bors merged 1 commit intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
@eddyb isolated the |
|
I think you can simply add that commit to #50070? |
src/librustc/ty/mod.rs
Outdated
There was a problem hiding this comment.
This could be Some(self.cmp(other)), to keep the implementation details in the Ord impl.
src/librustc/ty/mod.rs
Outdated
There was a problem hiding this comment.
Same here (Some(self.cmp(other))).
There was a problem hiding this comment.
Some(self.cmp(other)) will require the bound T: Ord, which I was not sure we wanted to impose for all types that that maybe only want to implement PartialOrd?
There was a problem hiding this comment.
Ah, I somehow missed that this was generic - seems fine, then.
src/librustc/ty/mod.rs
Outdated
src/librustc/ty/subst.rs
Outdated
There was a problem hiding this comment.
You don't need to implement all of this manually, just add #[derive(PartialEq, Eq, PartialOrd, Ord)] on UnpackedKind and implement this method going through that. That's how other traits are implemented on Kind.
There was a problem hiding this comment.
oops missed this one. Here is a pr for that #54074
|
@ishitatsuyuki A reason for extracting this into a separate PR was because the changes in this PR are isolated from #50070 and are useful on their own. Also this way others not familiar with #50070 can review these changes without prior context and hopefully its less messy and easier to understand :) |
c3c8049 to
fabe510
Compare
|
@nikomatsakis @eddyb rebased to master and should be ready for review |
|
@bors r+ |
|
📌 Commit fabe510 has been approved by |
|
☔ The latest upstream changes (presumably #50520) made this pull request unmergeable. Please resolve the merge conflicts. |
fabe510 to
6e3a2ed
Compare
|
@bors r+ |
|
📌 Commit 6e3a2ed has been approved by |
|
⌛ Testing commit 6e3a2ed7d3fd0173e507c3bf8f18bd416cdc640c with merge 4fc63c69d4512d3edc6b42624b34bba467b0ee29... |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1 similar comment
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
6e3a2ed to
1a159f6
Compare
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1a159f6 to
9a8400c
Compare
|
@bors r+ |
|
📌 Commit 9a8400c has been approved by |
implement Ord for OutlivesPredicate and other types It became necessary while implementing #50070 to have `Ord` implemented for `OutlivesPredicate`. This PR implements `Ord` for `OutlivesPredicate` as well as other types needed for the implementation.
|
☀️ Test successful - status-appveyor, status-travis |
| /// of 2<sup>(2<sup>8</sup> - 1)</sup>, which is limited by LLVM to a | ||
| /// maximum capacity of 2<sup>29</sup> or 536870912. | ||
| #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] | ||
| #[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Debug, RustcEncodable, RustcDecodable)] |
There was a problem hiding this comment.
This is a mistake, because this type does not have a defined ordering (see the min/max methods).
I'll try to figure out if I can fix it locally (as part of a PR that would probably remove the need for using this type in most places, by replacing it with one alignment, instead of two).
simplify ordering for Kind Missed from rust-lang#50930 r? @eddyb
It became necessary while implementing #50070 to have
Ordimplemented forOutlivesPredicate.This PR implements
OrdforOutlivesPredicateas well as other types needed for the implementation.