From b0e8c702ca41c6750409c6c71ed0f4c524161240 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Fri, 5 Feb 2016 16:22:45 -0800 Subject: [PATCH 1/2] Revert deprecation of IpAddr, stabilizing for 1.7 After [considerable pushback](https://github.com/rust-lang/rfcs/issues/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). --- src/libstd/net/addr.rs | 15 +++------------ src/libstd/net/ip.rs | 11 +++++------ src/libstd/net/mod.rs | 1 - src/libstd/net/parser.rs | 3 --- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 9382793b8bea2..320b2a0564d16 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -14,9 +14,7 @@ use fmt; use hash; use io; use mem; -use net::{lookup_host, ntoh, hton, Ipv4Addr, Ipv6Addr}; -#[allow(deprecated)] -use net::IpAddr; +use net::{lookup_host, ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; use option; use sys::net::netc as c; use sys_common::{FromInner, AsInner, IntoInner}; @@ -50,10 +48,7 @@ pub struct SocketAddrV6 { inner: c::sockaddr_in6 } impl SocketAddr { /// Creates a new socket address from the (ip, port) pair. - #[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")] - #[rustc_deprecated(reason = "ip type too small a type to pull its weight", - since = "1.6.0")] - #[allow(deprecated)] + #[stable(feature = "ip_addr", since = "1.7.0")] pub fn new(ip: IpAddr, port: u16) -> SocketAddr { match ip { IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)), @@ -62,10 +57,7 @@ impl SocketAddr { } /// Returns the IP address associated with this socket address. - #[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")] - #[rustc_deprecated(reason = "too small a type to pull its weight", - since = "1.6.0")] - #[allow(deprecated)] + #[stable(feature = "ip_addr", since = "1.7.0")] pub fn ip(&self) -> IpAddr { match *self { SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()), @@ -359,7 +351,6 @@ impl ToSocketAddrs for SocketAddrV6 { } #[stable(feature = "rust1", since = "1.0.0")] -#[allow(deprecated)] impl ToSocketAddrs for (IpAddr, u16) { type Iter = option::IntoIter; fn to_socket_addrs(&self) -> io::Result> { diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 341ba98191ae9..8a4d7e3e2c2a5 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -22,16 +22,15 @@ use sys::net::netc as c; use sys_common::{AsInner, FromInner}; /// An IP address, either an IPv4 or IPv6 address. -#[unstable(feature = "ip_addr", reason = "recent addition", issue = "27801")] -#[rustc_deprecated(reason = "too small a type to pull its weight", - since = "1.6.0")] +#[stable(feature = "ip_addr", since = "1.7.0")] #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)] -#[allow(deprecated)] pub enum IpAddr { /// Representation of an IPv4 address. - V4(Ipv4Addr), + #[stable(feature = "ip_addr", since = "1.7.0")] + V4(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.7.0"))] Ipv4Addr), /// Representation of an IPv6 address. - V6(Ipv6Addr), + #[stable(feature = "ip_addr", since = "1.7.0")] + V6(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.7.0"))] Ipv6Addr), } /// Representation of an IPv4 address. diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 545302b83931f..d263bf38495c1 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -18,7 +18,6 @@ use io::{self, Error, ErrorKind}; use sys_common::net as net_imp; #[stable(feature = "rust1", since = "1.0.0")] -#[allow(deprecated)] pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 91401c8e4fd2c..46a0309dbb509 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -17,7 +17,6 @@ use prelude::v1::*; use error::Error; use fmt; -#[allow(deprecated)] use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; use str::FromStr; @@ -262,7 +261,6 @@ impl<'a> Parser<'a> { self.read_atomically(|p| p.read_ipv6_addr_impl()) } - #[allow(deprecated)] fn read_ip_addr(&mut self) -> Option { let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr().map(IpAddr::V4); let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr().map(IpAddr::V6); @@ -308,7 +306,6 @@ impl<'a> Parser<'a> { } #[stable(feature = "rust1", since = "1.0.0")] -#[allow(deprecated)] impl FromStr for IpAddr { type Err = AddrParseError; fn from_str(s: &str) -> Result { From 71afb6b31961660bc8857d905ba4755ced6b58d9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Feb 2016 17:13:13 -0800 Subject: [PATCH 2/2] Bump beta to .3 --- mk/main.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/main.mk b/mk/main.mk index ef06119a8c7a2..3821b8d048332 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.7.0 # An optional number to put after the label, e.g. '.2' -> '-beta.2' # NB Make sure it starts with a dot to conform to semver pre-release # versions (section 9) -CFG_PRERELEASE_VERSION=.2 +CFG_PRERELEASE_VERSION=.3 # Append a version-dependent hash to each library, so we can install different # versions in the same place