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

PartialEq and PartialOrd between IpAddr and Ipv[46]Addr. #38464

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

clarfonthey
Copy link
Contributor

@clarfonthey clarfonthey commented Dec 19, 2016

PartialEq was rather useful, so, I figured that I'd implement it. I added PartialOrd for good measure.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@frewsxcv frewsxcv added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Dec 19, 2016
@clarfonthey clarfonthey changed the title PartialEq between IpAddr and Ipv[46]Addr. PartialEq and PartialOrd between IpAddr and Ipv[46]Addr. Dec 23, 2016
@alexcrichton
Copy link
Member

Looks good to me, thanks for the PR!

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Dec 25, 2016

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@lambda-fairy
Copy link
Contributor

lambda-fairy commented Dec 30, 2016

Can this lead to confusion down the line?

IPv4 addresses can be mapped into IPv6 ones, and so a user might expect e.g. Ipv4Addr(192.0.2.128) == Ipv6Addr(::ffff:192.0.2.128) to evaluate to true.

@clarfonthey
Copy link
Contributor Author

@lfairy that doesn't match the current implementation of PartialEq for IpAddr though. that sounds more like a fuzzy-matching than an equality comparison.

I tried coding a version of that type of match and I got: https://is.gd/6Yzorg

@lambda-fairy
Copy link
Contributor

@clarcharr My point isn't that fuzzy matching is a good idea (it probably isn't), but that a user may presume that it works that way. To someone who works on dual-stack IPv4/IPv6 code, the idea that Ipv4Addr(192.0.2.128) == Ipv6Addr(::ffff:192.0.2.128) may be as "obvious" to them, as the addresses being not equal is "obvious" to us.

@clarfonthey
Copy link
Contributor Author

@lfairy I feel like that's mostly a documentation change, though. it makes sense to me to document it if there is any fuzzy, inexact equality, but if it's just pure equality, I don't feel like that requires any documentation. right now that expression will be a compiler error

@clarfonthey clarfonthey closed this Jan 3, 2017
@clarfonthey clarfonthey deleted the ip_cmp branch January 3, 2017 04:48
@clarfonthey clarfonthey restored the ip_cmp branch January 3, 2017 04:48
@clarfonthey clarfonthey reopened this Jan 5, 2017
@sfackler
Copy link
Member

@brson @BurntSushi speak now or forever hold your peace

@bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2017

📌 Commit 9301e2e has been approved by sfackler

@bors
Copy link
Contributor

bors commented Jan 18, 2017

⌛ Testing commit 9301e2e with merge 72616b1...

@bors
Copy link
Contributor

bors commented Jan 18, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 18, 2017 via email

@bors
Copy link
Contributor

bors commented Jan 18, 2017

⌛ Testing commit 9301e2e with merge 90a9c8c...

@bors
Copy link
Contributor

bors commented Jan 18, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

alexcrichton commented Jan 18, 2017 via email

@KalitaAlexey
Copy link
Contributor

@alexcrichton,
Can't we make a bot try to download it multiple times? For example three attempts.

@clarfonthey
Copy link
Contributor Author

@KalitaAlexey I think that that issue is Appveyor's, not Rust's

@alexcrichton
Copy link
Member

@KalitaAlexey perhaps! I know just about as much as you probably do about AppVeyor, and PRs are always welcome!

@bors
Copy link
Contributor

bors commented Jan 18, 2017

⌛ Testing commit 9301e2e with merge 47daef8...

@bors
Copy link
Contributor

bors commented Jan 18, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 18, 2017 via email

@bors
Copy link
Contributor

bors commented Jan 18, 2017

⌛ Testing commit 9301e2e with merge 4cf483c...

@bors
Copy link
Contributor

bors commented Jan 19, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Jan 19, 2017 via email

@bors
Copy link
Contributor

bors commented Jan 19, 2017

⌛ Testing commit 9301e2e with merge 74c42ac...

bors added a commit that referenced this pull request Jan 19, 2017
PartialEq and PartialOrd between IpAddr and Ipv[46]Addr.

PartialEq was rather useful, so, I figured that I'd implement it. I added PartialOrd for good measure.
@bors
Copy link
Contributor

bors commented Jan 19, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: sfackler
Pushing 74c42ac to master...

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.

9 participants