-
Couldn't load subscription status.
- Fork 13.9k
Add missing examples for Ipv6Addr #37859
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
Conversation
|
@bors r+ rollup |
|
Travis error is unrelated. |
src/libstd/net/ip.rs
Outdated
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 should be [255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].
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.
Yep, good catch!
|
@bors r- |
ab27645 to
f6c6ad9
Compare
|
Updated. @bors: delegate=frewsxcv |
|
✌️ @frewsxcv can now approve this pull request |
|
@bors r+ rollup |
|
📌 Commit f6c6ad9 has been approved by |
src/libstd/net/ip.rs
Outdated
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 is a bad example, should use hex instead, since that’s the representation used most commonly.
Compare:
# for `2002:c000:2ff::` aka `::ffff:192.0.2.255`
let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
Using an 6to4 address is not a good idea either.
src/libstd/net/ip.rs
Outdated
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.
Similarly, use hex please.
src/libstd/net/ip.rs
Outdated
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.
Compare:
# for ::1c9:0:0:afc8:0:1
Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 1)
|
@bors: r- |
f6c6ad9 to
cddb062
Compare
|
Updated. |
src/libstd/net/ip.rs
Outdated
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.
C in 0x1c9 is uppercase, despite of everything else being lowercase.
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.
Nice catch!
src/libstd/net/ip.rs
Outdated
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 example doesn’t look right. 127.0.0.1 is ::ffff:7f00:0001. What you have there now is 192.10.2.255.
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.
Arf, indeed. Bad conversion!
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.
Probably also a good idea to show that e.g. ::1 converts to a 0.0.0.1 rather than None (i.e. it does both decimal and 4to6 conversions)
cddb062 to
6ae20df
Compare
|
Updated. |
|
r=me I also wrote a comment like this:
which got immediately hidden by a commit, but even without that the PR looks fine to me now. |
|
Then let's let @frewsxcv decide. :) |
I think it would be good to include @nagisa's example, but I don't feel strongly. r=me with these changes. |
6ae20df to
1a91fc6
Compare
|
📌 Commit 57be2d9 has been approved by |
|
@bors: r- |
57be2d9 to
a5049f7
Compare
|
@bors: r+ rollup |
|
📌 Commit a5049f7 has been approved by |
|
@bors: r=nagisa |
|
💡 This pull request was already approved, no need to approve it again.
|
|
📌 Commit a5049f7 has been approved by |
Add missing examples for Ipv6Addr r? @steveklabnik cc @frewsxcv
Add missing examples for Ipv6Addr r? @steveklabnik cc @frewsxcv
r? @steveklabnik
cc @frewsxcv