Skip to content

Commit 23fb974

Browse files
committed
Document std::string::ParseError
Part of #29376
1 parent 8bc43ed commit 23fb974

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/libcollections/string.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,18 @@ impl ops::DerefMut for String {
11411141
}
11421142
}
11431143

1144-
/// Error returned from `String::from`
1144+
/// An error when parsing a `String`.
1145+
///
1146+
/// This `enum` is slightly awkward: it will never actually exist. This error is
1147+
/// part of the type signature of the implementation of [`FromStr`] on
1148+
/// [`String`]. The return type of [`from_str()`], requires that an error be
1149+
/// defined, but, given that a [`String`] can always be made into a new
1150+
/// [`String`] without error, this type will never actually be returned. As
1151+
/// such, it is only here to satisfy said signature, and is useless otherwise.
1152+
///
1153+
/// [`FromStr`]: ../str/trait.FromStr.html
1154+
/// [`String`]: struct.String.html
1155+
/// [`from_str()`]: ../str/trait.FromStr.html#tymethod.from_str
11451156
#[stable(feature = "str_parse_error", since = "1.5.0")]
11461157
#[derive(Copy)]
11471158
pub enum ParseError {}

0 commit comments

Comments
 (0)