From ac77392f8ab1c201b0c927f6a2d30b632b95acda Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 31 Mar 2015 16:01:03 -0700 Subject: std: Stabilize last bits of io::Error This commit stabilizes a few remaining bits of the `io::Error` type: * The `Error::new` method is now stable. The last `detail` parameter was removed and the second `desc` parameter was generalized to `E: Into>` to allow creating an I/O error from any form of error. Currently there is no form of downcasting, but this will be added in time. * An implementation of `From<&str> for Box` was added to liballoc to allow construction of errors from raw strings. * The `Error::raw_os_error` method was stabilized as-is. * Trait impls for `Clone`, `Eq`, and `PartialEq` were removed from `Error` as it is not possible to use them with trait objects. This is a breaking change due to the modification of the `new` method as well as the removal of the trait implementations for the `Error` type. [breaking-change] --- src/libstd/sys/common/net2.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/libstd/sys/common') diff --git a/src/libstd/sys/common/net2.rs b/src/libstd/sys/common/net2.rs index a8ee40639e3..b4903096cce 100644 --- a/src/libstd/sys/common/net2.rs +++ b/src/libstd/sys/common/net2.rs @@ -75,7 +75,7 @@ fn sockaddr_to_addr(storage: &libc::sockaddr_storage, }))) } _ => { - Err(Error::new(ErrorKind::InvalidInput, "invalid argument", None)) + Err(Error::new(ErrorKind::InvalidInput, "invalid argument")) } } } @@ -158,8 +158,7 @@ pub fn lookup_addr(addr: &IpAddr) -> io::Result { match from_utf8(data.to_bytes()) { Ok(name) => Ok(name.to_string()), Err(_) => Err(io::Error::new(io::ErrorKind::Other, - "failed to lookup address information", - Some("invalid host name".to_string()))) + "failed to lookup address information")) } } -- cgit 1.4.1-3-g733a5