Skip to content

Commit 2067c57

Browse files
committed
Revert deprecation of IpAddr, stabilizing for 1.7
After [considerable pushback](rust-lang/rfcs#1451), it's clear that there is a community consensus around providing `IpAddr` in the standard library, together with other APIs using it. This commit reverts from deprecated status directly to stable. The deprecation landed in 1.6, which has already been released, so the stabilization is marked for 1.7 (currently in beta; will require a backport).
1 parent 34af2de commit 2067c57

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

src/libstd/net/addr.rs

+3-12
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ use fmt;
1414
use hash;
1515
use io;
1616
use mem;
17-
use net::{lookup_host, ntoh, hton, Ipv4Addr, Ipv6Addr};
18-
#[allow(deprecated)]
19-
use net::IpAddr;
17+
use net::{lookup_host, ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
2018
use option;
2119
use sys::net::netc as c;
2220
use sys_common::{FromInner, AsInner, IntoInner};
@@ -52,10 +50,7 @@ pub struct SocketAddrV6 { inner: c::sockaddr_in6 }
5250

5351
impl SocketAddr {
5452
/// Creates a new socket address from the (ip, port) pair.
55-
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
56-
#[rustc_deprecated(reason = "ip type too small a type to pull its weight",
57-
since = "1.6.0")]
58-
#[allow(deprecated)]
53+
#[stable(feature = "ip_addr", since = "1.7.0")]
5954
pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
6055
match ip {
6156
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
@@ -64,10 +59,7 @@ impl SocketAddr {
6459
}
6560

6661
/// Returns the IP address associated with this socket address.
67-
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
68-
#[rustc_deprecated(reason = "too small a type to pull its weight",
69-
since = "1.6.0")]
70-
#[allow(deprecated)]
62+
#[stable(feature = "ip_addr", since = "1.7.0")]
7163
pub fn ip(&self) -> IpAddr {
7264
match *self {
7365
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
@@ -361,7 +353,6 @@ impl ToSocketAddrs for SocketAddrV6 {
361353
}
362354

363355
#[stable(feature = "rust1", since = "1.0.0")]
364-
#[allow(deprecated)]
365356
impl ToSocketAddrs for (IpAddr, u16) {
366357
type Iter = option::IntoIter<SocketAddr>;
367358
fn to_socket_addrs(&self) -> io::Result<option::IntoIter<SocketAddr>> {

src/libstd/net/ip.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ use sys::net::netc as c;
2222
use sys_common::{AsInner, FromInner};
2323

2424
/// An IP address, either an IPv4 or IPv6 address.
25-
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
26-
#[rustc_deprecated(reason = "too small a type to pull its weight",
27-
since = "1.6.0")]
25+
#[stable(feature = "ip_addr", since = "1.7.0")]
2826
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)]
29-
#[allow(deprecated)]
3027
pub enum IpAddr {
3128
/// Representation of an IPv4 address.
32-
V4(Ipv4Addr),
29+
#[stable(feature = "ip_addr", since = "1.7.0")]
30+
V4(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.7.0"))] Ipv4Addr),
3331
/// Representation of an IPv6 address.
34-
V6(Ipv6Addr),
32+
#[stable(feature = "ip_addr", since = "1.7.0")]
33+
V6(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.7.0"))] Ipv6Addr),
3534
}
3635

3736
/// Representation of an IPv4 address.

src/libstd/net/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use io::{self, Error, ErrorKind};
1818
use sys_common::net as net_imp;
1919

2020
#[stable(feature = "rust1", since = "1.0.0")]
21-
#[allow(deprecated)]
2221
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2322
#[stable(feature = "rust1", since = "1.0.0")]
2423
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};

src/libstd/net/parser.rs

-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use prelude::v1::*;
1717

1818
use error::Error;
1919
use fmt;
20-
#[allow(deprecated)]
2120
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
2221
use str::FromStr;
2322

@@ -262,7 +261,6 @@ impl<'a> Parser<'a> {
262261
self.read_atomically(|p| p.read_ipv6_addr_impl())
263262
}
264263

265-
#[allow(deprecated)]
266264
fn read_ip_addr(&mut self) -> Option<IpAddr> {
267265
let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr().map(IpAddr::V4);
268266
let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr().map(IpAddr::V6);
@@ -308,7 +306,6 @@ impl<'a> Parser<'a> {
308306
}
309307

310308
#[stable(feature = "rust1", since = "1.0.0")]
311-
#[allow(deprecated)]
312309
impl FromStr for IpAddr {
313310
type Err = AddrParseError;
314311
fn from_str(s: &str) -> Result<IpAddr, AddrParseError> {

0 commit comments

Comments
 (0)