-
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 iter::order functions into methods on Iterator #27975
Conversation
I'm personally a fan of the API changes made here, and I'm kicking off a crater build now |
Crater reports one regression, but it's because of |
cc @rust-lang/libs |
These can use IntoIterator arguments now, by the way (and should, anywhere they go). |
I like free functions for their symmetry in both arguments. IntoIterator emphasizes the asymmetry with methods even more. That said, these methods work too. |
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc rust-lang#27737
f4dc754
to
651c42f
Compare
@bors r=aturon |
📌 Commit 651c42f has been approved by |
This does cause some breakage due to deficiencies in resolve - `path::Components` is both an `Iterator` and implements `Eq`, `Ord`, etc. If one calls e.g. `partial_cmp` on a `Components` and passes a `&Components` intending to target the `PartialOrd` impl, the compiler will select the `partial_cmp` from `Iterator` and then error out. I doubt anyone will run into breakage from `Components` specifically, but we should see if there are third party types that will run into issues. `iter::order::equals` wasn't moved to `Iterator` since it's exactly the same as `iter::order::eq` but with an `Eq` instead of `PartialEq` bound, which doensn't seem very useful. I also updated `le`, `gt`, etc to use `partial_cmp` which lets us drop the extra `PartialEq` bound. cc #27737 r? @alexcrichton
This does cause some breakage due to deficiencies in resolve -
path::Components
is both anIterator
and implementsEq
,Ord
,etc. If one calls e.g.
partial_cmp
on aComponents
and passes a&Components
intending to target thePartialOrd
impl, the compilerwill select the
partial_cmp
fromIterator
and then error out. Idoubt anyone will run into breakage from
Components
specifically, butwe should see if there are third party types that will run into issues.
iter::order::equals
wasn't moved toIterator
since it's exactly thesame as
iter::order::eq
but with anEq
instead ofPartialEq
bound,which doensn't seem very useful.
I also updated
le
,gt
, etc to usepartial_cmp
which lets us dropthe extra
PartialEq
bound.cc #27737
r? @alexcrichton