Skip to content

Commit 3c6a7ba

Browse files
committed
---
yaml --- r: 191481 b: refs/heads/try c: 3e43373 h: refs/heads/master i: 191479: aba36cb v: v3
1 parent 6476303 commit 3c6a7ba

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 809a554fca2d0ebc2ba50077016fe282a4064752
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
5-
refs/heads/try: 4294327886ed7c1a21148f86941418a8a5950381
5+
refs/heads/try: 3e433738fb1ab9f353c943d60061d72024c6af07
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libstd/net/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub use self::ip::{Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
2525
pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
2626
pub use self::tcp::{TcpStream, TcpListener};
2727
pub use self::udp::UdpSocket;
28+
pub use self::parser::AddrParseError;
2829

2930
mod ip;
3031
mod addr;

branches/try/src/libstd/net/parser.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -296,35 +296,40 @@ impl<'a> Parser<'a> {
296296
}
297297
}
298298

299+
#[stable(feature = "rust1", since = "1.0.0")]
299300
impl FromStr for Ipv4Addr {
300-
type Err = ParseError;
301-
fn from_str(s: &str) -> Result<Ipv4Addr, ParseError> {
301+
type Err = AddrParseError;
302+
fn from_str(s: &str) -> Result<Ipv4Addr, AddrParseError> {
302303
match Parser::new(s).read_till_eof(|p| p.read_ipv4_addr()) {
303304
Some(s) => Ok(s),
304-
None => Err(ParseError)
305+
None => Err(AddrParseError(()))
305306
}
306307
}
307308
}
308309

310+
#[stable(feature = "rust1", since = "1.0.0")]
309311
impl FromStr for Ipv6Addr {
310-
type Err = ParseError;
311-
fn from_str(s: &str) -> Result<Ipv6Addr, ParseError> {
312+
type Err = AddrParseError;
313+
fn from_str(s: &str) -> Result<Ipv6Addr, AddrParseError> {
312314
match Parser::new(s).read_till_eof(|p| p.read_ipv6_addr()) {
313315
Some(s) => Ok(s),
314-
None => Err(ParseError)
316+
None => Err(AddrParseError(()))
315317
}
316318
}
317319
}
318320

321+
#[stable(feature = "rust1", since = "1.0.0")]
319322
impl FromStr for SocketAddr {
320-
type Err = ParseError;
321-
fn from_str(s: &str) -> Result<SocketAddr, ParseError> {
323+
type Err = AddrParseError;
324+
fn from_str(s: &str) -> Result<SocketAddr, AddrParseError> {
322325
match Parser::new(s).read_till_eof(|p| p.read_socket_addr()) {
323326
Some(s) => Ok(s),
324-
None => Err(ParseError),
327+
None => Err(AddrParseError(())),
325328
}
326329
}
327330
}
328331

329-
#[derive(Debug, Clone, PartialEq, Copy)]
330-
pub struct ParseError;
332+
/// An error returned when parsing an IP address or a socket address.
333+
#[stable(feature = "rust1", since = "1.0.0")]
334+
#[derive(Debug, Clone, PartialEq)]
335+
pub struct AddrParseError(());

0 commit comments

Comments
 (0)