Skip to content

Commit 0bfe307

Browse files
committed
Auto merge of #50435 - cuviper:rm-lookup_host, r=sfackler
Remove the deprecated std::net::{lookup_host,LookupHost} These are unstable, and were deprecated by #47510, since Rust 1.25. The internal `sys` implementations are still kept to support the call in the common `resolve_socket_addr`.
2 parents 22a41e4 + b539936 commit 0bfe307

File tree

3 files changed

+3
-72
lines changed

3 files changed

+3
-72
lines changed

src/libstd/net/addr.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ use hash;
1313
use io;
1414
use mem;
1515
use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr};
16-
#[allow(deprecated)]
17-
use net::lookup_host;
1816
use option;
1917
use sys::net::netc as c;
2018
use sys_common::{FromInner, AsInner, IntoInner};
19+
use sys_common::net::lookup_host;
2120
use vec;
2221
use iter;
2322
use slice;
@@ -856,7 +855,6 @@ impl ToSocketAddrs for (Ipv6Addr, u16) {
856855
}
857856
}
858857

859-
#[allow(deprecated)]
860858
fn resolve_socket_addr(s: &str, p: u16) -> io::Result<vec::IntoIter<SocketAddr>> {
861859
let ips = lookup_host(s)?;
862860
let v: Vec<_> = ips.map(|mut a| { a.set_port(p); a }).collect();

src/libstd/net/mod.rs

-65
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
3939
#![stable(feature = "rust1", since = "1.0.0")]
4040

41-
use fmt;
4241
use io::{self, Error, ErrorKind};
43-
use sys_common::net as net_imp;
4442

4543
#[stable(feature = "rust1", since = "1.0.0")]
4644
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
@@ -128,66 +126,3 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
128126
"could not resolve to any addresses")
129127
}))
130128
}
131-
132-
/// An iterator over `SocketAddr` values returned from a host lookup operation.
133-
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
134-
iterator and returning socket \
135-
addresses",
136-
issue = "27705")]
137-
#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")]
138-
pub struct LookupHost(net_imp::LookupHost);
139-
140-
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
141-
iterator and returning socket \
142-
addresses",
143-
issue = "27705")]
144-
#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")]
145-
#[allow(deprecated)]
146-
impl Iterator for LookupHost {
147-
type Item = SocketAddr;
148-
fn next(&mut self) -> Option<SocketAddr> { self.0.next() }
149-
}
150-
151-
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
152-
iterator and returning socket \
153-
addresses",
154-
issue = "27705")]
155-
#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")]
156-
#[allow(deprecated)]
157-
impl fmt::Debug for LookupHost {
158-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
159-
f.pad("LookupHost { .. }")
160-
}
161-
}
162-
163-
/// Resolve the host specified by `host` as a number of `SocketAddr` instances.
164-
///
165-
/// This method may perform a DNS query to resolve `host` and may also inspect
166-
/// system configuration to resolve the specified hostname.
167-
///
168-
/// The returned iterator will skip over any unknown addresses returned by the
169-
/// operating system.
170-
///
171-
/// # Examples
172-
///
173-
/// ```no_run
174-
/// #![feature(lookup_host)]
175-
///
176-
/// use std::net;
177-
///
178-
/// fn main() -> std::io::Result<()> {
179-
/// for host in net::lookup_host("rust-lang.org")? {
180-
/// println!("found address: {}", host);
181-
/// }
182-
/// Ok(())
183-
/// }
184-
/// ```
185-
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
186-
iterator and returning socket \
187-
addresses",
188-
issue = "27705")]
189-
#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")]
190-
#[allow(deprecated)]
191-
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
192-
net_imp::lookup_host(host).map(LookupHost)
193-
}

src/test/run-pass/sync-send-in-std.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
// ignore-cloudabi networking not available
1212
// ignore-wasm32-bare networking not available
1313

14-
#![feature(lookup_host)]
15-
16-
use std::net::lookup_host;
14+
use std::net::ToSocketAddrs;
1715

1816
fn is_sync<T>(_: T) where T: Sync {}
1917
fn is_send<T>(_: T) where T: Send {}
@@ -30,5 +28,5 @@ macro_rules! all_sync_send {
3028
}
3129

3230
fn main() {
33-
all_sync_send!(lookup_host("localhost").unwrap(), next);
31+
all_sync_send!("localhost:80".to_socket_addrs().unwrap(), next);
3432
}

0 commit comments

Comments
 (0)