-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement AddAssign for String #34890
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String { | |||
} | |||
} | |||
|
|||
#[stable(feature = "rust1", since = "1.11.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line caused a make tidy
error:
different `since` than before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, what's the right thing to do with these stable
annotations in a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it's ok to pick an arbitrary feature name here, and the since I believe at this point should be 1.12.0
cc @rust-lang/libs, seems reasonable to me given that |
@@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String { | |||
} | |||
} | |||
|
|||
#[stable(feature = "rust1", since = "1.12.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to pick a different (arbitrary) feature here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, now I understand what you guys were saying above.
sgtm |
Libs team discussed and said, 'yeap'. @bors r+ |
📌 Commit 9b81306 has been approved by |
⌛ Testing commit 9b81306 with merge d87d602... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
@bors: retry On Tue, Jul 19, 2016 at 9:31 PM, bors notifications@github.com wrote:
|
@bors: rollup |
⌛ Testing commit 9b81306 with merge 4c1a383... |
💔 Test failed - auto-linux-64-cargotest |
@bors: retry On Wed, Jul 20, 2016 at 6:17 PM, bors notifications@github.com wrote:
|
implement AddAssign for String Currently `String` implements `Add` but not `AddAssign`. This PR fills in that gap. I played around with having `AddAssign` (and `Add` and `push_str`) take `AsRef<str>` instead of `&str`, but it looks like that breaks arguments that implement `Deref<Target=str>` and not `AsRef<str>`. Comments in [`libcore/convert.rs`](https://github.com/rust-lang/rust/blob/master/src/libcore/convert.rs#L207-L213) make it sound like we could fix this with a blanket impl eventually. Does anyone know what's blocking that?
Currently
String
implementsAdd
but notAddAssign
. This PR fills in that gap.I played around with having
AddAssign
(andAdd
andpush_str
) takeAsRef<str>
instead of&str
, but it looks like that breaks arguments that implementDeref<Target=str>
and notAsRef<str>
. Comments inlibcore/convert.rs
make it sound like we could fix this with a blanket impl eventually. Does anyone know what's blocking that?