about summary refs log tree commit diff
path: root/src/liballoc/string.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-05 23:08:08 +0000
committerbors <bors@rust-lang.org>2020-07-05 23:08:08 +0000
commit0c03aee8b81185d65b5821518661c30ecdb42de5 (patch)
tree5d9ea2c252f737710f1a071b08babc537c90ca2c /src/liballoc/string.rs
parent2753fab7ce3647033146b07c8b6c9f4856a910b0 (diff)
parente62436333eb4c3d98c23f1a0478e35a843cc4b95 (diff)
downloadrust-0c03aee8b81185d65b5821518661c30ecdb42de5.tar.gz
rust-0c03aee8b81185d65b5821518661c30ecdb42de5.zip
Auto merge of #74073 - Manishearth:rollup-faqo9lx, r=Manishearth
Rollup of 12 pull requests

Successful merges:

 - #72688 (added .collect() into String from Box<str>)
 - #73787 (Add unstable docs for rustc_attrs)
 - #73834 (Some refactoring around intrinsic type checking)
 - #73871 (Fix try_print_visible_def_path for Rust 2018)
 - #73937 (Explain exhaustive matching on {usize,isize} maximum values)
 - #73973 (Use `Span`s to identify unreachable subpatterns in or-patterns)
 - #74000 (add `lazy_normalization_consts` feature gate)
 - #74025 (Remove unnecessary release from Arc::try_unwrap)
 - #74027 (Convert more `DefId`s to `LocalDefId`s)
 - #74055 (Fix spacing in Iterator fold doc)
 - #74057 (expected_found `&T` -> `T`)
 - #74064 (variant_count: avoid incorrect dummy implementation)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc/string.rs')
-rw-r--r--src/liballoc/string.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 13ef94dee23..5b671b41b5b 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -1774,6 +1774,15 @@ impl FromIterator<String> for String {
     }
 }
 
+#[stable(feature = "box_str2", since = "1.45.0")]
+impl FromIterator<Box<str>> for String {
+    fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> String {
+        let mut buf = String::new();
+        buf.extend(iter);
+        buf
+    }
+}
+
 #[stable(feature = "herd_cows", since = "1.19.0")]
 impl<'a> FromIterator<Cow<'a, str>> for String {
     fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
@@ -1842,6 +1851,13 @@ impl<'a> Extend<&'a str> for String {
     }
 }
 
+#[stable(feature = "box_str2", since = "1.45.0")]
+impl Extend<Box<str>> for String {
+    fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I) {
+        iter.into_iter().for_each(move |s| self.push_str(&s));
+    }
+}
+
 #[stable(feature = "extend_string", since = "1.4.0")]
 impl Extend<String> for String {
     fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {