Skip to content

Commit 7cfee19

Browse files
committed
---
yaml --- r: 193980 b: refs/heads/beta c: 3e43373 h: refs/heads/master v: v3
1 parent ff86c84 commit 7cfee19

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
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 4294327886ed7c1a21148f86941418a8a5950381
34+
refs/heads/beta: 3e433738fb1ab9f353c943d60061d72024c6af07
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/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/beta/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)