Skip to content

Commit b0e8c70

Browse files
aturonalexcrichton
authored andcommitted
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 9d6e26d commit b0e8c70

File tree

4 files changed

+8
-22
lines changed

4 files changed

+8
-22
lines changed

src/libstd/net/addr.rs

Lines changed: 3 additions & 12 deletions
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};
@@ -50,10 +48,7 @@ pub struct SocketAddrV6 { inner: c::sockaddr_in6 }
5048

5149
impl SocketAddr {
5250
/// Creates a new socket address from the (ip, port) pair.
53-
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
54-
#[rustc_deprecated(reason = "ip type too small a type to pull its weight",
55-
since = "1.6.0")]
56-
#[allow(deprecated)]
51+
#[stable(feature = "ip_addr", since = "1.7.0")]
5752
pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
5853
match ip {
5954
IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
@@ -62,10 +57,7 @@ impl SocketAddr {
6257
}
6358

6459
/// Returns the IP address associated with this socket address.
65-
#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")]
66-
#[rustc_deprecated(reason = "too small a type to pull its weight",
67-
since = "1.6.0")]
68-
#[allow(deprecated)]
60+
#[stable(feature = "ip_addr", since = "1.7.0")]
6961
pub fn ip(&self) -> IpAddr {
7062
match *self {
7163
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
@@ -359,7 +351,6 @@ impl ToSocketAddrs for SocketAddrV6 {
359351
}
360352

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

src/libstd/net/ip.rs

Lines changed: 5 additions & 6 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 3 deletions
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)