From 6a09df9079279297c5f68c0a1214a17e8193cd6a Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Sun, 17 Jul 2016 11:31:44 -0400 Subject: [PATCH 1/3] implement AddAssign for String --- src/libcollections/string.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index eedf4c2c11f..688f0576042 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -59,7 +59,7 @@ use core::fmt; use core::hash; use core::iter::FromIterator; use core::mem; -use core::ops::{self, Add, Index, IndexMut}; +use core::ops::{self, Add, AddAssign, Index, IndexMut}; use core::ptr; use core::str::pattern::Pattern; use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER}; @@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String { } } +#[stable(feature = "rust1", since = "1.11.0")] +impl<'a> AddAssign<&'a str> for String { + #[inline] + fn add_assign(&mut self, other: &str) { + self.push_str(other); + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl ops::Index> for String { type Output = str; From cac58ab5b7501a7ea3146a4521d8f34389bc3f73 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Mon, 18 Jul 2016 14:00:35 -0400 Subject: [PATCH 2/3] update the since field to 1.12.0 for String AddAssign --- src/libcollections/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 688f0576042..3920b57962c 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1559,7 +1559,7 @@ impl<'a> Add<&'a str> for String { } } -#[stable(feature = "rust1", since = "1.11.0")] +#[stable(feature = "rust1", since = "1.12.0")] impl<'a> AddAssign<&'a str> for String { #[inline] fn add_assign(&mut self, other: &str) { From 9b8130666de569d6d27332d42df43859a57b3e72 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Mon, 18 Jul 2016 14:27:17 -0400 Subject: [PATCH 3/3] use a new feature name for String AddAssign --- src/libcollections/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 3920b57962c..71c6a6c892e 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1559,7 +1559,7 @@ impl<'a> Add<&'a str> for String { } } -#[stable(feature = "rust1", since = "1.12.0")] +#[stable(feature = "stringaddassign", since = "1.12.0")] impl<'a> AddAssign<&'a str> for String { #[inline] fn add_assign(&mut self, other: &str) {