Skip to content

Remove the deprecated std::net::{lookup_host,LookupHost} #50435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ use hash;
use io;
use mem;
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};
use sys_common::net::lookup_host;
use vec;
use iter;
use slice;
Expand Down Expand Up @@ -856,7 +855,6 @@ impl ToSocketAddrs for (Ipv6Addr, u16) {
}
}

#[allow(deprecated)]
fn resolve_socket_addr(s: &str, p: u16) -> io::Result<vec::IntoIter<SocketAddr>> {
let ips = lookup_host(s)?;
let v: Vec<_> = ips.map(|mut a| { a.set_port(p); a }).collect();
Expand Down
65 changes: 0 additions & 65 deletions src/libstd/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@

#![stable(feature = "rust1", since = "1.0.0")]

use fmt;
use io::{self, Error, ErrorKind};
use sys_common::net as net_imp;

#[stable(feature = "rust1", since = "1.0.0")]
pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
Expand Down Expand Up @@ -128,66 +126,3 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
"could not resolve to any addresses")
}))
}

/// An iterator over `SocketAddr` values returned from a host lookup operation.
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25.0", 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.0", reason = "Use the ToSocketAddrs trait instead")]
#[allow(deprecated)]
impl Iterator for LookupHost {
type Item = SocketAddr;
fn next(&mut self) -> Option<SocketAddr> { self.0.next() }
}

#[unstable(feature = "lookup_host", reason = "unsure about the returned \
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25.0", 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 { .. }")
}
}

/// Resolve the host specified by `host` as a number of `SocketAddr` instances.
///
/// This method may perform a DNS query to resolve `host` and may also inspect
/// system configuration to resolve the specified hostname.
///
/// The returned iterator will skip over any unknown addresses returned by the
/// operating system.
///
/// # Examples
///
/// ```no_run
/// #![feature(lookup_host)]
///
/// use std::net;
///
/// fn main() -> std::io::Result<()> {
/// for host in net::lookup_host("rust-lang.org")? {
/// println!("found address: {}", host);
/// }
/// Ok(())
/// }
/// ```
#[unstable(feature = "lookup_host", reason = "unsure about the returned \
iterator and returning socket \
addresses",
issue = "27705")]
#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")]
#[allow(deprecated)]
pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
net_imp::lookup_host(host).map(LookupHost)
}
6 changes: 2 additions & 4 deletions src/test/run-pass/sync-send-in-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
// ignore-cloudabi networking not available
// ignore-wasm32-bare networking not available

#![feature(lookup_host)]

use std::net::lookup_host;
use std::net::ToSocketAddrs;

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

fn main() {
all_sync_send!(lookup_host("localhost").unwrap(), next);
all_sync_send!("localhost:80".to_socket_addrs().unwrap(), next);
}