Skip to content
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

Merged
merged 1 commit into from
Aug 27, 2015

Conversation

sfackler
Copy link
Member

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

@alexcrichton
Copy link
Member

I'm personally a fan of the API changes made here, and I'm kicking off a crater build now

@alexcrichton
Copy link
Member

Crater reports one regression, but it's because of #![deny(deprecated)] instead of an actual problem, so I think we're A-OK with this.

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Aug 25, 2015
@alexcrichton
Copy link
Member

cc @rust-lang/libs

@bluss
Copy link
Member

bluss commented Aug 25, 2015

These can use IntoIterator arguments now, by the way (and should, anywhere they go).

@bluss
Copy link
Member

bluss commented Aug 25, 2015

I like free functions for their symmetry in both arguments. IntoIterator emphasizes the asymmetry with methods even more. That said, these methods work too.

@aturon
Copy link
Member

aturon commented Aug 26, 2015

This looks great to me, thanks @sfackler! (I do agree with @bluss about IntoIterator).

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
@sfackler sfackler force-pushed the iter-order-methods branch from f4dc754 to 651c42f Compare August 27, 2015 06:24
@sfackler
Copy link
Member Author

@bors r=aturon

@bors
Copy link
Contributor

bors commented Aug 27, 2015

📌 Commit 651c42f has been approved by aturon

@bors
Copy link
Contributor

bors commented Aug 27, 2015

⌛ Testing commit 651c42f with merge d6a65cd...

bors added a commit that referenced this pull request Aug 27, 2015
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
@bors bors merged commit 651c42f into rust-lang:master Aug 27, 2015
@sfackler sfackler deleted the iter-order-methods branch November 26, 2016 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants