Skip to content
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

Merged
merged 3 commits into from
Jul 21, 2016
Merged

implement AddAssign for String #34890

merged 3 commits into from
Jul 21, 2016

Conversation

oconnor663
Copy link
Contributor

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 make it sound like we could fix this with a blanket impl eventually. Does anyone know what's blocking that?

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@apasel422 apasel422 added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jul 18, 2016
@@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String {
}
}

#[stable(feature = "rust1", since = "1.11.0")]
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Member

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

@alexcrichton
Copy link
Member

cc @rust-lang/libs, seems reasonable to me given that Add is stabilized

@@ -1559,6 +1559,14 @@ impl<'a> Add<&'a str> for String {
}
}

#[stable(feature = "rust1", since = "1.12.0")]
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@brson
Copy link
Contributor

brson commented Jul 18, 2016

sgtm

@brson
Copy link
Contributor

brson commented Jul 18, 2016

Libs team discussed and said, 'yeap'.

@bors r+

@bors
Copy link
Contributor

bors commented Jul 18, 2016

📌 Commit 9b81306 has been approved by brson

@brson brson added the relnotes Marks issues that should be documented in the release notes of the next release. label Jul 18, 2016
@bors
Copy link
Contributor

bors commented Jul 20, 2016

⌛ Testing commit 9b81306 with merge d87d602...

@bors
Copy link
Contributor

bors commented Jul 20, 2016

💔 Test failed - auto-win-gnu-32-opt-rustbuild

@alexcrichton
Copy link
Member

@bors: retry

On Tue, Jul 19, 2016 at 9:31 PM, bors notifications@github.com wrote:

💔 Test failed - auto-win-gnu-32-opt-rustbuild
https://buildbot.rust-lang.org/builders/auto-win-gnu-32-opt-rustbuild/builds/1827


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
#34890 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95D-QEQ7QiYhovywnkS7nyFidwEeEks5qXaSjgaJpZM4JOS2O
.

@alexcrichton
Copy link
Member

@bors: rollup

@bors
Copy link
Contributor

bors commented Jul 21, 2016

⌛ Testing commit 9b81306 with merge 4c1a383...

@bors
Copy link
Contributor

bors commented Jul 21, 2016

💔 Test failed - auto-linux-64-cargotest

@alexcrichton
Copy link
Member

@bors: retry

On Wed, Jul 20, 2016 at 6:17 PM, bors notifications@github.com wrote:

💔 Test failed - auto-linux-64-cargotest
https://buildbot.rust-lang.org/builders/auto-linux-64-cargotest/builds/1199


You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
#34890 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAD95JXSq-1RxtlpblIRUCUu-M_wT6xOks5qXsikgaJpZM4JOS2O
.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jul 21, 2016
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?
@bors bors merged commit 9b81306 into rust-lang:master Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants