@@ -768,18 +768,27 @@ impl fmt::Display for FromUtf16Error {
768768
769769#[ stable( feature = "rust1" , since = "1.0.0" ) ]
770770impl FromIterator < char > for String {
771- fn from_iter < I : IntoIterator < Item =char > > ( iter : I ) -> String {
771+ fn from_iter < I : IntoIterator < Item =char > > ( iterable : I ) -> String {
772772 let mut buf = String :: new ( ) ;
773- buf. extend ( iter ) ;
773+ buf. extend ( iterable ) ;
774774 buf
775775 }
776776}
777777
778778#[ stable( feature = "rust1" , since = "1.0.0" ) ]
779779impl < ' a > FromIterator < & ' a str > for String {
780- fn from_iter < I : IntoIterator < Item =& ' a str > > ( iter : I ) -> String {
780+ fn from_iter < I : IntoIterator < Item =& ' a str > > ( iterable : I ) -> String {
781781 let mut buf = String :: new ( ) ;
782- buf. extend ( iter) ;
782+ buf. extend ( iterable) ;
783+ buf
784+ }
785+ }
786+
787+ #[ stable( feature = "extend_string" , since = "1.4.0" ) ]
788+ impl FromIterator < String > for String {
789+ fn from_iter < I : IntoIterator < Item =String > > ( iterable : I ) -> String {
790+ let mut buf = String :: new ( ) ;
791+ buf. extend ( iterable) ;
783792 buf
784793 }
785794}
@@ -798,8 +807,8 @@ impl Extend<char> for String {
798807
799808#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
800809impl < ' a > Extend < & ' a char > for String {
801- fn extend < I : IntoIterator < Item =& ' a char > > ( & mut self , iter : I ) {
802- self . extend ( iter . into_iter ( ) . cloned ( ) ) ;
810+ fn extend < I : IntoIterator < Item =& ' a char > > ( & mut self , iterable : I ) {
811+ self . extend ( iterable . into_iter ( ) . cloned ( ) ) ;
803812 }
804813}
805814
@@ -812,6 +821,15 @@ impl<'a> Extend<&'a str> for String {
812821 }
813822}
814823
824+ #[ stable( feature = "extend_string" , since = "1.4.0" ) ]
825+ impl Extend < String > for String {
826+ fn extend < I : IntoIterator < Item =String > > ( & mut self , iterable : I ) {
827+ for s in iterable {
828+ self . push_str ( & s)
829+ }
830+ }
831+ }
832+
815833/// A convenience impl that delegates to the impl for `&str`
816834impl < ' a , ' b > Pattern < ' a > for & ' b String {
817835 type Searcher = <& ' b str as Pattern < ' a > >:: Searcher ;
0 commit comments