diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 1ca7e66ed9ca9..fa430939f058c 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -12,7 +12,9 @@ use fmt; use hash; use io; use mem; -use net::{lookup_host, ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; +use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; +#[allow(deprecated)] +use net::lookup_host; use option; use sys::net::netc as c; use sys_common::{FromInner, AsInner, IntoInner}; @@ -845,6 +847,7 @@ impl ToSocketAddrs for (Ipv6Addr, u16) { } } +#[allow(deprecated)] fn resolve_socket_addr(s: &str, p: u16) -> io::Result> { let ips = lookup_host(s)?; let v: Vec<_> = ips.map(|mut a| { a.set_port(p); a }).collect(); diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 9fcb93e2032b3..eb0e2e13b4cd2 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -134,12 +134,15 @@ fn each_addr(addr: A, mut f: F) -> io::Result iterator and returning socket \ addresses", issue = "27705")] +#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")] pub struct LookupHost(net_imp::LookupHost); #[unstable(feature = "lookup_host", reason = "unsure about the returned \ iterator and returning socket \ addresses", issue = "27705")] +#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")] +#[allow(deprecated)] impl Iterator for LookupHost { type Item = SocketAddr; fn next(&mut self) -> Option { self.0.next() } @@ -149,6 +152,8 @@ impl Iterator for LookupHost { iterator and returning socket \ addresses", issue = "27705")] +#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")] +#[allow(deprecated)] impl fmt::Debug for LookupHost { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.pad("LookupHost { .. }") @@ -181,6 +186,8 @@ impl fmt::Debug for LookupHost { iterator and returning socket \ addresses", issue = "27705")] +#[rustc_deprecated(since = "1.25", reason = "Use the ToSocketAddrs trait instead")] +#[allow(deprecated)] pub fn lookup_host(host: &str) -> io::Result { net_imp::lookup_host(host).map(LookupHost) }