-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
impl FromIterator<&char> for String #40028
Conversation
Was sad to observe that this impl is not backwards compatible: impl<T> FromIterator<T> for String where String: Extend<T> {
fn from_iter<I: Iterator<Item = T>>(iter: I) -> String {
let mut string = String::new();
string.extend(iter);
string
}
} Nor this even more useful impl: // something something monoid
impl<T, C> FromIterator<T> for C where C: Default + Extend<T> {
fn from_iter<I: Iterator<Item = T>>(iter: I) -> String {
let mut collection = C::default();
collection.extend(iter);
collection
}
} |
@rfcbot fcp merge Looks good to me! |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Do we do this kind of implicit dereference elsewhere? Can I for example collect an |
@sfackler we implement But I also would definitely support |
If I also think there should be parity between |
I can add that impl to this PR.
(Note there's no extend impl so there's no parity in that case). That impl would need a crater run, but I have trouble imagining code that would not have enough contextual information to distinguish a |
TIL |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@bors: r+ |
📌 Commit 097398e has been approved by |
I'll try to remember to put up another PR for the Cow impl |
…excrichton impl FromIterator<&char> for String
AFAICS, that impl is only used for its |
Oh sorry I was thinking of this impl, namely: impl<'a, T: 'a + Copy> Extend<&'a T> for Vec<T> { I forgot that it was only |
Unfortunately this was just released though so we don't have much time to rethink the merge... |
Yeah, I only got here because of the release notes. |
No description provided.