Skip to content

Commit

Permalink
Auto merge of #28635 - alexcrichton:str-parse-error-void, r=aturon
Browse files Browse the repository at this point in the history
It can never be instantiated, so signify this by having it actually be an empty
`enum`.

cc #27734
  • Loading branch information
bors committed Sep 26, 2015
2 parents 54f7b1d + 81f0bf7 commit 6f880ee
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ impl ops::DerefMut for String {
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
Void if it ever exists",
issue = "27734")]
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct ParseError(());
#[derive(Copy)]
pub enum ParseError {}

#[stable(feature = "rust1", since = "1.0.0")]
impl FromStr for String {
Expand All @@ -1053,6 +1053,26 @@ impl FromStr for String {
}
}

impl Clone for ParseError {
fn clone(&self) -> ParseError {
match *self {}
}
}

impl fmt::Debug for ParseError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}

impl PartialEq for ParseError {
fn eq(&self, _: &ParseError) -> bool {
match *self {}
}
}

impl Eq for ParseError {}

/// A generic trait for converting a value to a string
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ToString {
Expand Down

0 comments on commit 6f880ee

Please sign in to comment.