@@ -1982,45 +1982,6 @@ impl Add<&str> for String {
19821982 }
19831983}
19841984
1985- // This had to be added to avoid breakage after adding `impl Add<char> for String`
1986- #[ allow( missing_docs) ]
1987- #[ stable( feature = "extra_add_string_and_dbl_ref_str" , since = "1.41.0" ) ]
1988- impl Add < & & str > for String {
1989- type Output = String ;
1990-
1991- #[ inline]
1992- fn add ( mut self , other : & & str ) -> String {
1993- self . push_str ( other) ;
1994- self
1995- }
1996- }
1997-
1998- // This had to be added to avoid breakage after adding `impl Add<char> for String`
1999- #[ allow( missing_docs) ]
2000- #[ stable( feature = "extra_add_string_and_ref_string" , since = "1.41.0" ) ]
2001- impl Add < & String > for String {
2002- type Output = String ;
2003-
2004- #[ inline]
2005- fn add ( mut self , other : & String ) -> String {
2006- self . push_str ( other) ;
2007- self
2008- }
2009- }
2010-
2011- // This had to be added to avoid breakage after adding `impl Add<char> for String`
2012- #[ allow( missing_docs) ]
2013- #[ stable( feature = "extra_add_string_and_dbl_ref_string" , since = "1.41.0" ) ]
2014- impl Add < & & String > for String {
2015- type Output = String ;
2016-
2017- #[ inline]
2018- fn add ( mut self , other : & & String ) -> String {
2019- self . push_str ( other) ;
2020- self
2021- }
2022- }
2023-
20241985/// Implements the `+` operator for concatenating a string and a char together.
20251986///
20261987/// This consumes the `String` on the left-hand side and re-uses its buffer (growing it if
@@ -2067,6 +2028,21 @@ impl Add<char> for String {
20672028 }
20682029}
20692030
2031+ // This had to be added to avoid breakage after adding `impl Add<char> for String`
2032+ macro_rules! string_add_impl_extras {
2033+ ( $( $t: ty) * ) => ( $(
2034+ #[ stable( feature = "string_add_extras" , since = "1.41.0" ) ]
2035+ impl Add <$t> for String {
2036+ type Output = String ;
2037+
2038+ #[ inline]
2039+ fn add( mut self , other: $t) -> String { self . push_str( other) ; self }
2040+ }
2041+ ) * )
2042+ }
2043+
2044+ string_add_impl_extras ! { &&str &&& str &&&&str & String &&String &&& String &&&&String }
2045+
20702046/// Implements the `+=` operator for appending to a `String`.
20712047///
20722048/// This has the same behavior as the [`push_str`][String::push_str] method.
@@ -2078,17 +2054,6 @@ impl AddAssign<&str> for String {
20782054 }
20792055}
20802056
2081- /// Implements the `+=` operator for appending to a `String`.
2082- ///
2083- /// This has the same behavior as the [`push_str`][String::push_str] method.
2084- #[ stable( feature = "string_add_assign_string" , since = "1.41.0" ) ]
2085- impl AddAssign < & String > for String {
2086- #[ inline]
2087- fn add_assign ( & mut self , other : & String ) {
2088- self . push_str ( other) ;
2089- }
2090- }
2091-
20922057/// Implements the `+=` operator for appending a `char` to a `String`.
20932058///
20942059/// This has the same behavior as the [`push`][String::push] method.
@@ -2100,6 +2065,20 @@ impl AddAssign<char> for String {
21002065 }
21012066}
21022067
2068+ // This had to be added to avoid breakage after adding `impl AddAssign<char> for String`
2069+ macro_rules! string_addassign_impl_extras {
2070+ ( $( $t: ty) * ) => ( $(
2071+ #[ stable( feature = "string_addassign_extras" , since = "1.41.0" ) ]
2072+ impl AddAssign <$t> for String {
2073+
2074+ #[ inline]
2075+ fn add_assign( & mut self , other: $t) { self . push_str( other) ; }
2076+ }
2077+ ) * )
2078+ }
2079+
2080+ string_addassign_impl_extras ! { & String &&String &&& String &&&&String &&str &&& str &&&&str }
2081+
21032082#[ stable( feature = "rust1" , since = "1.0.0" ) ]
21042083impl ops:: Index < ops:: Range < usize > > for String {
21052084 type Output = str ;
0 commit comments