about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2019-01-10 15:40:05 -0500
committerSteve Klabnik <steve@steveklabnik.com>2019-01-10 17:08:27 -0500
commitbeb6495862942903d71e39e328b62b58cd6d2bb2 (patch)
treedff44b5899257ca8b8b87d46cc0be09189cb1d44 /src/libcore
parent6ecad338381cc3b8d56e2df22e5971a598eddd6c (diff)
downloadrust-beb6495862942903d71e39e328b62b58cd6d2bb2.tar.gz
rust-beb6495862942903d71e39e328b62b58cd6d2bb2.zip
note that FromStr does not work for borrowed types
Fixes #47757
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/str/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 689d456d412..bdde187d931 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -20,8 +20,7 @@ pub mod pattern;
 #[allow(missing_docs)]
 pub mod lossy;
 
-/// A trait to abstract the idea of creating a new instance of a type from a
-/// string.
+/// Parse a value from a string
 ///
 /// `FromStr`'s [`from_str`] method is often used implicitly, through
 /// [`str`]'s [`parse`] method. See [`parse`]'s documentation for examples.
@@ -30,6 +29,11 @@ pub mod lossy;
 /// [`str`]: ../../std/primitive.str.html
 /// [`parse`]: ../../std/primitive.str.html#method.parse
 ///
+/// `FromStr` does not have a lifetime parameter, and so you can only parse types
+/// that do not contain a lifetime parameter themselves. In other words, you can
+/// parse an `i32` with `FromStr`, but not a `&i32`. You can parse a struct that
+/// contains an `i32`, but not one that contains an `&i32`.
+///
 /// # Examples
 ///
 /// Basic implementation of `FromStr` on an example `Point` type: