@@ -1982,45 +1982,6 @@ impl Add<&str> for String {
1982
1982
}
1983
1983
}
1984
1984
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
-
2024
1985
/// Implements the `+` operator for concatenating a string and a char together.
2025
1986
///
2026
1987
/// 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 {
2067
2028
}
2068
2029
}
2069
2030
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
+
2070
2046
/// Implements the `+=` operator for appending to a `String`.
2071
2047
///
2072
2048
/// This has the same behavior as the [`push_str`][String::push_str] method.
@@ -2078,17 +2054,6 @@ impl AddAssign<&str> for String {
2078
2054
}
2079
2055
}
2080
2056
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
-
2092
2057
/// Implements the `+=` operator for appending a `char` to a `String`.
2093
2058
///
2094
2059
/// This has the same behavior as the [`push`][String::push] method.
@@ -2100,6 +2065,20 @@ impl AddAssign<char> for String {
2100
2065
}
2101
2066
}
2102
2067
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
+
2103
2082
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2104
2083
impl ops:: Index < ops:: Range < usize > > for String {
2105
2084
type Output = str ;
0 commit comments