Skip to content

Commit cdf0542

Browse files
committed
deprecate Ipv4Addr::to_ipv6_compatible
1 parent cfdf9d3 commit cdf0542

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

library/std/src/net/ip.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,10 @@ impl Ipv4Addr {
771771
/// );
772772
/// ```
773773
#[stable(feature = "rust1", since = "1.0.0")]
774+
#[rustc_deprecated(
775+
since = "1.47.0",
776+
reason = "the current IPv6 transition mechanisms no longer use these addresses"
777+
)]
774778
pub fn to_ipv6_compatible(&self) -> Ipv6Addr {
775779
let octets = self.octets();
776780
Ipv6Addr::from([
@@ -2073,11 +2077,16 @@ mod tests {
20732077
}
20742078

20752079
#[test]
2076-
fn ipv4_to_ipv6() {
2080+
fn ipv4_to_ipv6_mapped() {
20772081
assert_eq!(
20782082
Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0x1234, 0x5678),
20792083
Ipv4Addr::new(0x12, 0x34, 0x56, 0x78).to_ipv6_mapped()
20802084
);
2085+
}
2086+
2087+
#[test]
2088+
#[allow(deprecated)]
2089+
fn ipv4_to_ipv6_compatible() {
20812090
assert_eq!(
20822091
Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0x1234, 0x5678),
20832092
Ipv4Addr::new(0x12, 0x34, 0x56, 0x78).to_ipv6_compatible()

0 commit comments

Comments
 (0)