Uh oh!
There was an error while loading. Please reload this page.
Add Ipv6Addr::to_ipv4_mapped - #75019
Conversation
rust-highfive
commented
Aug 1, 2020
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @hanna-kruppe (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. |
a89e2ed to
5f0be61CompareThere was a problem hiding this comment.
| pubfn to_ipv4_mapped(&self) -> Option<Ipv4Addr>{ | |
| #[unstable(feature = "ipv4_mapped", issue = "none")] | |
| pubfn to_ipv4_mapped(&self) -> Option<Ipv4Addr>{ |
There was a problem hiding this comment.
Do I need to add #![feature(ipv4_mapped)] to the lib.rs?
There was a problem hiding this comment.
Although there is already an unstable feature named ip, do I still need to add a new unstable feature?
#27709
https://github.com/rust-lang/rust/blob/master/library/std/src/net/ip.rs#L1-L7
There was a problem hiding this comment.
I asked on Zulip and it looks like adding stuff to existing unstable features is fine. So just use the ip feature :)
There was a problem hiding this comment.
Since you requested another review: the unstable attribute is still missing. Please add #[unstable(feature = "ip", issue = "27709")] right above the line containing pub fn.
There was a problem hiding this comment.
Since the following lines have been added at the beginning of this file (ip.rs):
#![unstable( feature = "ip", reason = "extra functionality has not been \ scrutinized to the level that it should \ be to be stable", issue = "27709")]Adding #[unstable(feature = "ip", issue = "27709")] above this fn is unnecessary.
There was a problem hiding this comment.
(It is better to give a permanent link to those code lines in the future).
c889fc3 to
288784eCompareUh oh!
There was an error while loading. Please reload this page.
hanna-kruppe
commented
Aug 2, 2020
@lzutao is right, the deprecation should not happen before the replacement is stable. It's also not clear to me why the deprecation in the IETF RFC ("New or updated implementations are not required to support this address type.") should translate to a deprecation of the Rust API (which remains useful for any particular implementation that intends to support such addresses in some way). Both issues can be side-stepped by only adding the new encoding for now, without deprecating anything. Deprecating could be a separate discussion at a later date (e.g., after stabilization of the new API) and should probably go through @rust-lang/libs in some way. |
There is no replacement for
|
Do you want to fix it in a different PR although the intention is to deprecate it ? |
@lzutao If we want to fix it, we may need to change the return type of |
nanpuyue
commented
Aug 2, 2020
Perhaps it should be discussed when to deprecate |
nanpuyue
commented
Aug 2, 2020
hanna-kruppe
commented
Aug 3, 2020
Deprecating a stable method without deprecation sounds like something that needs a @rust-lang/libs FCP, so (rolls dice) r? @LukasKalbertodt |
LukasKalbertodt
left a comment
There was a problem hiding this comment.
I don't know a lot about IP6 and that stuff, but since it looks like the RFC defines these mappable addresses, it seems useful to add this method, I think.
@hanna-kruppe@lzutao Do you agree adding this as unstable makes sense?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
You still need to add the unstable attribute.
hanna-kruppe
commented
Aug 8, 2020
I don't know much about networking either, but FWIW I do agree. |
There was a problem hiding this comment.
This paragraph should still be improved. See my suggestion here
There was a problem hiding this comment.
Since you requested another review: the unstable attribute is still missing. Please add #[unstable(feature = "ip", issue = "27709")] right above the line containing pub fn.
Uh oh!
There was an error while loading. Please reload this page.
LukasKalbertodt
commented
Aug 11, 2020
Thanks, the docs look fine now. But I am somewhat confused: the |
nanpuyue
commented
Aug 11, 2020
@LukasKalbertodt |
LukasKalbertodt
commented
Aug 12, 2020
bors
commented
Aug 12, 2020
📌 Commit d892a07 has been approved by |
bors
commented
Aug 12, 2020
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
bors
commented
Aug 12, 2020
bors
commented
Aug 12, 2020
☀️ Test successful - checks-actions, checks-azure |
…le, r=LukasKalbertodt Add a note for Ipv4Addr::to_ipv6_compatible Previous discussion: rust-lang#75019 > I think adding a comment saying "This isn't typically the method you want; these addresses don't typically function on modern systems. Use `to_ipv6_mapped` instead." would be a good first step, whether this method gets marked as deprecated or not. _Originally posted by @joshtriplett in rust-lang#75150 (comment)
Move stability attribute for items under the `ip` feature The `#[unstable]` attribute for items under the `ip` feature is currently located on the `std::net::ip` module itself. This is unusual, and less readable. This has sidetracked discussion about these items numerous times (rust-lang#60145 (comment), rust-lang#76098 (comment), rust-lang#76098 (comment), rust-lang#75019 (comment), rust-lang#75019 (comment)) and lead to incorrect assumptions about which items are actually stable (rust-lang#60145 (comment), rust-lang#76098 (comment)). This PR moves the attribute from the module to the items themselves.
Move stability attribute for items under the `ip` feature The `#[unstable]` attribute for items under the `ip` feature is currently located on the `std::net::ip` module itself. This is unusual, and less readable. This has sidetracked discussion about these items numerous times (rust-lang#60145 (comment), rust-lang#76098 (comment), rust-lang#76098 (comment), rust-lang#75019 (comment), rust-lang#75019 (comment)) and lead to incorrect assumptions about which items are actually stable (rust-lang#60145 (comment), rust-lang#76098 (comment)). This PR moves the attribute from the module to the items themselves.
deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4reference: Add a note for Ipv4Addr::to_ipv6_compatible #75150According to IETF RFC 4291, the "IPv4-Compatible IPv6 address" is deprecated.
And the current implementation of
Ipv4Addr::to_ipv6_compatibleis incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.Please let me know if there are any issues with this pull request.