-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add a note for Ipv4Addr::to_ipv6_compatible #75150
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (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. |
There is no replacement for
Originally posted by @nanpuyue in #75019 (comment) |
I am not quite convinced we want to hard-deprecate this method in std. While I absolutely I agree we should mention in the docs that these kinds of addresses were deprecated in the IETF RFC, I don't necessarily think this should translate 1:1 to the Rust standard library. People might have to deal with these IPv6 addresses in their code. I don't really see the advantage of deprecating it. @rust-lang/libs any opinions? In particular, @BurntSushi, I think you are usually not a fan of hard deprecations? |
…rtodt Add Ipv6Addr::to_ipv4_mapped * add Ipv6Addr::to_ipv4_mapped * ~~deprecate Ipv4Addr::to_ipv6_compatible & Ipv6Addr::to_ipv4~~ reference: rust-lang#75150 According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10), the "IPv4-Compatible IPv6 address" is deprecated. > 2.5.5.1. IPv4-Compatible IPv6 Address > > The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6 > transition. The format of the "IPv4-Compatible IPv6 address" is as > follows: > > | 80 bits | 16 | 32 bits | > +--------------------------------------+--------------------------+ > |0000..............................0000|0000| IPv4 address | > +--------------------------------------+----+---------------------+ > > Note: The IPv4 address used in the "IPv4-Compatible IPv6 address" > must be a globally-unique IPv4 unicast address. > > The "IPv4-Compatible IPv6 address" is now deprecated because the > current IPv6 transition mechanisms no longer use these addresses. > New or updated implementations are not required to support this > address type. And the current implementation of `Ipv4Addr::to_ipv6_compatible`is 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.
Created a zulip thread to discuss this further. |
Related: #75046 As noted the I’m also not sure if we need to deprecate these methods or just point out in their docs how their behaviour might differ from what you expect. I have been finding usages on GitHub for |
I think adding a comment saying "This isn't typically the method you want; these addresses don't typically function on modern systems. Use |
☔ The latest upstream changes (presumably #75979) made this pull request unmergeable. Please resolve the merge conflicts. |
@nanpuyue could you change this PR to only add a note in the docs similar to what @joshtriplett wrote? Thus not adding the |
cdf0542
to
3b29913
Compare
@LukasKalbertodt It's done. |
Thanks! @bors r+ rollup=always |
📌 Commit 3b29913 has been approved by |
Rollup of 12 pull requests Successful merges: - rust-lang#75150 (Add a note for Ipv4Addr::to_ipv6_compatible) - rust-lang#76120 (Add `[T; N]::as_[mut_]slice`) - rust-lang#76142 (Make all methods of `std::net::Ipv4Addr` const) - rust-lang#76164 (Link to slice pattern in array docs) - rust-lang#76167 (Replace MinGW library hack with heuristic controlling link mode) - rust-lang#76204 (Rename and expose LoopState as ControlFlow) - rust-lang#76238 (Move to intra-doc links for library/core/src/iter/traits/iterator.rs) - rust-lang#76242 (Read: adjust a FIXME reference) - rust-lang#76243 (Fix typos in vec try_reserve(_exact) docs) - rust-lang#76245 (inliner: Avoid query cycles when optimizing generators) - rust-lang#76255 (Update books) - rust-lang#76261 (Use intra-doc links in `core::marker`) Failed merges: r? @ghost
Previous discussion: #75019
Originally posted by @joshtriplett in #75150 (comment)