Skip to content

Commit 81f0bf7

Browse files
committed
std: Switch string::ParseError to an empty enum
It can never be instantiated, so signify this by having it actually be an empty `enum`. cc #27734
1 parent 8fe79bd commit 81f0bf7

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/libcollections/string.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ impl ops::DerefMut for String {
10301030
#[unstable(feature = "str_parse_error", reason = "may want to be replaced with \
10311031
Void if it ever exists",
10321032
issue = "27734")]
1033-
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
1034-
pub struct ParseError(());
1033+
#[derive(Copy)]
1034+
pub enum ParseError {}
10351035

10361036
#[stable(feature = "rust1", since = "1.0.0")]
10371037
impl FromStr for String {
@@ -1042,6 +1042,26 @@ impl FromStr for String {
10421042
}
10431043
}
10441044

1045+
impl Clone for ParseError {
1046+
fn clone(&self) -> ParseError {
1047+
match *self {}
1048+
}
1049+
}
1050+
1051+
impl fmt::Debug for ParseError {
1052+
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
1053+
match *self {}
1054+
}
1055+
}
1056+
1057+
impl PartialEq for ParseError {
1058+
fn eq(&self, _: &ParseError) -> bool {
1059+
match *self {}
1060+
}
1061+
}
1062+
1063+
impl Eq for ParseError {}
1064+
10451065
/// A generic trait for converting a value to a string
10461066
#[stable(feature = "rust1", since = "1.0.0")]
10471067
pub trait ToString {

0 commit comments

Comments
 (0)