about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-02-28 22:55:30 -0500
committerGitHub <noreply@github.com>2017-02-28 22:55:30 -0500
commit0a008b949e4ea5ccec83a6a7a90b695f9a0f55df (patch)
treea2633ce749d68b438309000c661ab42292c16056
parent06a0233ab315c68e45dce27e0fdb74ff340b2fd9 (diff)
parent097398e3837770dce1ee8609083b7344cb983e95 (diff)
downloadrust-0a008b949e4ea5ccec83a6a7a90b695f9a0f55df.tar.gz
rust-0a008b949e4ea5ccec83a6a7a90b695f9a0f55df.zip
Rollup merge of #40028 - withoutboats:string_from_iter, r=alexcrichton
impl FromIterator<&char> for String
-rw-r--r--src/libcollections/string.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 6839b698a56..4b37aef860d 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -1483,6 +1483,15 @@ impl FromIterator<char> for String {
     }
 }
 
+#[stable(feature = "string_from_iter_by_ref", since = "1.17.0")]
+impl<'a> FromIterator<&'a char> for String {
+    fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
+        let mut buf = String::new();
+        buf.extend(iter);
+        buf
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> FromIterator<&'a str> for String {
     fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {