Repository: rust
Issue: Tracking issue for Ipv{4,6}Addr convenience methods
Labels: T-libs-api,B-unstable,C-tracking-issue,A-io,Libs-Tracked

The below is a list of methods left to be stabilized under the `ip` feature. The path forward today is unclear; if you'd like to push through any method on here the libs team is interested in a PR with links to the associated RFCs or other official documentation. Let us know!

 - [ ] [`IpAddr::is_documentation`](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html#method.is_documentation)
 - [ ] [`Ipv6Addr::is_documentation`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_documentation)

****

 - [ ] [`IpAddr::is_global`](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html#method.is_global) 
 - [ ] [`Ipv4Addr::is_global`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_global)
 - [ ] [`Ipv6Addr::is_global`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_global)

****

 - [ ] [`Ipv4Addr::is_shared`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_shared)
 - ~~[`Ipv4Addr::is_ietf_protocol_assignment`](https://doc.rust-lang.org/1.55.0/std/net/struct.Ipv4Addr.html#method.is_ietf_protocol_assignment)~~ https://github.com/rust-lang/rust/pull/86439
 - [ ] [`Ipv4Addr::is_benchmarking`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_benchmarking)
- [ ] [`Ipv4Addr::is_reserved`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_reserved)

****

 - [ ] [`Ipv6Addr::is_unicast_global`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_unicast_global)
 - [ ] [`Ipv6Addr::is_unicast_link_local`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_unicast_link_local)
 - ~~[`Ipv6Addr::is_unicast_link_local_strict`](https://doc.rust-lang.org/1.53.0/std/net/struct.Ipv6Addr.html#method.is_unicast_link_local_strict)~~ https://github.com/rust-lang/rust/pull/85819
 - ~~[`Ipv6Addr::is_unicast_site_local`](https://doc.rust-lang.org/1.54.0/std/net/struct.Ipv6Addr.html#method.is_unicast_site_local)~~ https://github.com/rust-lang/rust/pull/85820
 - [ ] [`Ipv6Addr::is_unique_local`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_unique_local)
 - [ ] [`Ipv6Addr::multicast_scope`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.multicast_scope)

****

- [ ] [`Ipv6Addr::is_ipv4_mapped`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_ipv4_mapped)
- [x] [`Ipv6Addr::to_ipv4_mapped`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.to_ipv4_mapped) https://github.com/rust-lang/rust/pull/96906
- [x] [`Ipv6Addr::to_canonical`](https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.to_canonical) https://github.com/rust-lang/rust/pull/115955
- [x] [`IpAddr::to_canonical`](https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html#method.to_canonical) https://github.com/rust-lang/rust/pull/115955

## Steps

- [ ] Implementation https://github.com/rust-lang/rust/pull/22015
- [ ] Implementation https://github.com/rust-lang/rust/pull/34694
- [ ] Stabilization attempt https://github.com/rust-lang/rust/pull/66584
- [ ] Stabilization attempt https://github.com/rust-lang/rust/pull/76098
- [ ] Stabilization PR(s)

Subsets of the listed methods can be stabilized, rather than attempting to stabilize everything at once.

## Unresolved Questions

- [ ] Differences between Rust and other languages https://github.com/rust-lang/rust/pull/76098#issuecomment-761234042
- [ ] More specific case of the above: does the IPv6 unicast interface do what we expect? https://github.com/rust-lang/rust/issues/85604
- [ ] Do the provided methods pass ipcheck? https://github.com/rust-lang/libs-team/tree/93b78eef2e0d455a3e69c05333cd8f276e4e95f1/tools/ipcheck. Last known run: https://github.com/rust-lang/rust/pull/76098#issuecomment-760651861

From @KodrAus in https://github.com/rust-lang/rust/pull/76098#issuecomment-760841554:

- [ ] Should we replace the `Ipv6Addr::is_unicast_*` methods with a `Ipv6Addr::unicast_scope` method that returns a `Ipv6UnicastScope` enum (https://github.com/rust-lang/rust/pull/76098#issuecomment-735019872)?
- [ ] Should we change the behavior of `Ipv6Addr::to_ipv4` to ignore deprecated IPv4-compatible addresses, or deprecate the whole method in favor of the more correct `Ipv6Addr::to_ipv4_mapped` method (https://github.com/rust-lang/rust/pull/76098#discussion_r530465408)?
- [ ] Are we ok with `Ipv6Addr::is_*` methods now properly considering mapped (non-deprecated) IPv4 addresses? I'd personally be comfortable considering the old behavior a bug.
- [ ] Are there any behavioral differences between other language implementations that we should investigate? (https://github.com/rust-lang/rust/pull/76098#issuecomment-760651861)