@@ -1982,8 +1982,9 @@ 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`
1985
1986
#[ allow( missing_docs) ]
1986
- #[ stable( feature = "add_string_and_dbl_ref_str " , since = "1.41.0" ) ]
1987
+ #[ stable( feature = "extra_add_string_and_dbl_ref_str " , since = "1.41.0" ) ]
1987
1988
impl Add < & & str > for String {
1988
1989
type Output = String ;
1989
1990
@@ -1994,44 +1995,9 @@ impl Add<&&str> for String {
1994
1995
}
1995
1996
}
1996
1997
1997
- /// Implements the `+` operator for concatenating two `String`s.
1998
- ///
1999
- /// This consumes the `String` on the left-hand side and re-uses its buffer (growing it if
2000
- /// necessary). This is done to avoid allocating a new `String` and copying the entire contents on
2001
- /// every operation, which would lead to `O(n^2)` running time when building an `n`-byte string by
2002
- /// repeated concatenation.
2003
- ///
2004
- /// The string on the right-hand side is only borrowed; its contents are copied into the returned
2005
- /// `String`.
2006
- ///
2007
- /// # Examples
2008
- ///
2009
- /// Concatenating two `String`s takes the first by value and borrows the second:
2010
- ///
2011
- /// ```
2012
- /// let a = String::from("hello");
2013
- /// let b = String::from(" world");
2014
- /// let c = a + &b;
2015
- /// // `a` is moved and can no longer be used here.
2016
- /// ```
2017
- ///
2018
- /// If you want to keep using the first `String`, you can clone it and append to the clone instead:
2019
- ///
2020
- /// ```
2021
- /// let a = String::from("hello");
2022
- /// let b = String::from(" world");
2023
- /// let c = a.clone() + &b;
2024
- /// // `a` is still valid here.
2025
- /// ```
2026
- ///
2027
- /// Concatenating `&str` slices can be done by converting the first to a `String`:
2028
- ///
2029
- /// ```
2030
- /// let a = "hello";
2031
- /// let b = " world";
2032
- /// let c = a.to_string() + b;
2033
- /// ```
2034
- #[ stable( feature = "add_string_and_ref_string" , since = "1.41.0" ) ]
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" ) ]
2035
2001
impl Add < & String > for String {
2036
2002
type Output = String ;
2037
2003
@@ -2042,8 +2008,9 @@ impl Add<&String> for String {
2042
2008
}
2043
2009
}
2044
2010
2011
+ // This had to be added to avoid breakage after adding `impl Add<char> for String`
2045
2012
#[ allow( missing_docs) ]
2046
- #[ stable( feature = "add_string_and_dbl_ref_string " , since = "1.41.0" ) ]
2013
+ #[ stable( feature = "extra_add_string_and_dbl_ref_string " , since = "1.41.0" ) ]
2047
2014
impl Add < & & String > for String {
2048
2015
type Output = String ;
2049
2016
@@ -2114,7 +2081,7 @@ impl AddAssign<&str> for String {
2114
2081
/// Implements the `+=` operator for appending to a `String`.
2115
2082
///
2116
2083
/// This has the same behavior as the [`push_str`][String::push_str] method.
2117
- #[ stable( feature = "stringaddassign_string " , since = "1.41.0" ) ]
2084
+ #[ stable( feature = "string_add_assign_string " , since = "1.41.0" ) ]
2118
2085
impl AddAssign < & String > for String {
2119
2086
#[ inline]
2120
2087
fn add_assign ( & mut self , other : & String ) {
@@ -2125,7 +2092,7 @@ impl AddAssign<&String> for String {
2125
2092
/// Implements the `+=` operator for appending a `char` to a `String`.
2126
2093
///
2127
2094
/// This has the same behavior as the [`push`][String::push] method.
2128
- #[ stable( feature = "stringaddassign_char " , since = "1.41.0" ) ]
2095
+ #[ stable( feature = "string_add_assign_char " , since = "1.41.0" ) ]
2129
2096
impl AddAssign < char > for String {
2130
2097
#[ inline]
2131
2098
fn add_assign ( & mut self , other : char ) {
0 commit comments