Skip to content

Commit

Permalink
Auto merge of #27976 - sfackler:addrparseerror-error, r=alexcrichton
Browse files Browse the repository at this point in the history
Closes #27973
  • Loading branch information
bors committed Aug 24, 2015
2 parents 797d0ba + f266f12 commit b74ec4c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/libstd/net/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use prelude::v1::*;

use str::FromStr;
use error::Error;
use fmt;
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use str::FromStr;

struct Parser<'a> {
// parsing as ASCII, so can use byte array
Expand Down Expand Up @@ -339,3 +341,17 @@ impl FromStr for SocketAddr {
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug, Clone, PartialEq)]
pub struct AddrParseError(());

#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
impl fmt::Display for AddrParseError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write_str(self.description())
}
}

#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
impl Error for AddrParseError {
fn description(&self) -> &str {
"invalid IP address syntax"
}
}

0 comments on commit b74ec4c

Please sign in to comment.